gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [libebics] branch master updated: fixing CTRL-C hang.


From: gnunet
Subject: [GNUnet-SVN] [libebics] branch master updated: fixing CTRL-C hang.
Date: Mon, 22 Oct 2018 16:04:54 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository libebics.

The following commit(s) were added to refs/heads/master by this push:
     new 63f0abf  fixing CTRL-C hang.
63f0abf is described below

commit 63f0abf6d2272725f8dbf677ba56937c081b39b5
Author: Marcello Stanisci <address@hidden>
AuthorDate: Mon Oct 22 16:04:33 2018 +0200

    fixing CTRL-C hang.
---
 src/libebics.c      | 49 ++++++++++++++++++++++++++++++-------------------
 src/sandbox_tests.c |  1 +
 2 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/src/libebics.c b/src/libebics.c
index c6b8881..91832ea 100644
--- a/src/libebics.c
+++ b/src/libebics.c
@@ -167,8 +167,9 @@ init_libgcrypt ()
 static int
 free_libgcrypt ()
 {
-  /* TODO or not ? */
-  return EBICS_ERROR;
+  LOG (EBICS_LOGLEVEL_WARNING,
+       "Just a STUB from libgcrypt deinit!");
+  return EBICS_SUCCESS;
 }
 
 /**
@@ -481,7 +482,8 @@ init_keymaterial (struct EBICS_Key keyList[],
 static int
 free_keymaterial (struct EBICS_Key keyList[])
 {
-  LOG (EBICS_LOGLEVEL_DEBUG, "Freeing key material");
+  LOG (EBICS_LOGLEVEL_DEBUG,
+       "Freeing key material\n");
 
   int retv;
   int result = EBICS_SUCCESS;
@@ -490,8 +492,11 @@ free_keymaterial (struct EBICS_Key keyList[])
   {
     if (keyList[i].type == EBICS_KEY_NONE)
       continue;
+
     struct EBICS_Key *key = &keyList[i];
-    LOG (EBICS_LOGLEVEL_DEBUG, "Freeing Key with name: %s", key->name);
+    LOG (EBICS_LOGLEVEL_DEBUG,
+         "Freeing Key with name: %s\n",
+         key->name);
     gnutls_x509_privkey_deinit (key->privatekey);
     key->privatekey = NULL;
     gnutls_pubkey_deinit (key->publickey);
@@ -638,7 +643,7 @@ parse_response (struct GNUNET_CURL_DownloadBuffer *db,
                 long *http_status)
 {
   xmlParserCtxtPtr parser;
-  xmlDocPtr doc;
+  xmlDocPtr doc = NULL;
   http_status = 0;
 
   if (0 == db->eno)
@@ -779,20 +784,22 @@ EBICS_init_library (const char *key_dir,
 int
 EBICS_close_library ()
 {
-  int retv;
-
-  retv = free_libgcrypt ();
-  if (retv)
-    return (retv);
+  #define CLOSE_LIB(name) do \
+    { int retv; \
+      if (retv = free_##name ()) \
+      { \
+        LOG (EBICS_LOGLEVEL_WARNING, \
+             "Could not deinit %s correctly\n", \
+             #name); \
+        return retv; \
+      } \
+    } \
+    while (0)
+
+  CLOSE_LIB (libgcrypt);
+  CLOSE_LIB (libxmlsec);
+  CLOSE_LIB (zlib);
 
-  retv = free_libxmlsec ();
-  if (retv)
-    return (retv);
-
-  retv = free_zlib ();
-  if (retv)
-    return (retv);
-  
   free_libgnutls ();
   xmlCleanupParser ();
 
@@ -801,6 +808,8 @@ EBICS_close_library ()
 
   GNUNET_CURL_gnunet_rc_destroy (reschedule_ctx);
   GNUNET_CURL_fini (ctx);
+
+  return EBICS_SUCCESS;
 }
 
 /**
@@ -1019,7 +1028,9 @@ process_response (void *cls,
 /**
  * Prepare and POSTs a EBICS HTTPS message to the bank.
  *
- * @param document the document to POST
+ * @param document the document to POST; no need for
+ *        the caller to keep it allocated, as it'll be
+ *        copied by libcurl.
  * @param URL url of the EBICS endpoint
  * @param cb callback to pass the response data
  * @return the CURL job, or NULL upon errors.
diff --git a/src/sandbox_tests.c b/src/sandbox_tests.c
index 6280821..db3a3c4 100644
--- a/src/sandbox_tests.c
+++ b/src/sandbox_tests.c
@@ -144,6 +144,7 @@ run ()
     return;
   }
 
+  /* legal, as it gets copied by libcurl */
   GNUNET_free (msg);
   result = EBICS_SUCCESS;
 }

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]