gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: fix FTBS, fix memory leak, remo


From: gnunet
Subject: [taler-anastasis] branch master updated: fix FTBS, fix memory leak, remove '= NULL' after GNUNET_free ()
Date: Mon, 26 Oct 2020 16:24:45 +0100

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

dennis-neufeld pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new e47001e  fix FTBS, fix memory leak, remove '= NULL' after GNUNET_free 
()
e47001e is described below

commit e47001e173a6bff638e20dfa15529bfb7fa473e1
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Mon Oct 26 16:24:30 2020 +0100

    fix FTBS, fix memory leak, remove '= NULL' after GNUNET_free ()
---
 src/backend/anastasis-httpd_truth.c               |  1 -
 src/backend/anastasis_authorization_plugin.c      |  2 --
 src/backend/anastasis_authorization_plugin_file.c |  8 +++++---
 src/lib/anastasis.c                               | 12 ------------
 src/lib/anastasis_api_policy_store.c              |  3 ---
 src/lib/testing_api_cmd_truth_store.c             |  2 --
 src/lib/testing_cmd_policy_create.c               |  1 -
 src/lib/testing_cmd_recover_secret.c              |  1 -
 src/lib/testing_cmd_secret_share.c                |  9 ++++-----
 src/lib/testing_cmd_truth_upload.c                |  1 -
 src/stasis/anastasis_db_plugin.c                  |  3 ---
 src/stasis/test_anastasis_db.c                    |  4 ----
 12 files changed, 9 insertions(+), 38 deletions(-)

diff --git a/src/backend/anastasis-httpd_truth.c 
b/src/backend/anastasis-httpd_truth.c
index 6286396..01892ce 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -153,7 +153,6 @@ request_done (struct TM_HandlerContext *hc)
     gc->as = NULL;
   }
   GNUNET_free (gc);
-  gc = NULL;
   hc->ctx = NULL;
 }
 
diff --git a/src/backend/anastasis_authorization_plugin.c 
b/src/backend/anastasis_authorization_plugin.c
index 35f768d..63ca51f 100644
--- a/src/backend/anastasis_authorization_plugin.c
+++ b/src/backend/anastasis_authorization_plugin.c
@@ -110,7 +110,6 @@ ANASTASIS_authorization_plugin_unload
   GNUNET_assert (NULL == GNUNET_PLUGIN_unload (lib_name,
                                                plugin));
   GNUNET_free (lib_name);
-  lib_name = NULL;
 }
 
 
@@ -188,7 +187,6 @@ plugin_fini ()
   if (NULL != old_dlsearchpath)
   {
     GNUNET_free (old_dlsearchpath);
-    old_dlsearchpath = NULL;
   }
   lt_dlexit ();
 }
diff --git a/src/backend/anastasis_authorization_plugin_file.c 
b/src/backend/anastasis_authorization_plugin_file.c
index 6841a4d..ecc0dbe 100644
--- a/src/backend/anastasis_authorization_plugin_file.c
+++ b/src/backend/anastasis_authorization_plugin_file.c
@@ -20,6 +20,7 @@
  */
 #include "platform.h"
 #include "anastasis_authorization_plugin.h"
+#include <taler/taler_mhd_lib.h>
 
 
 /**
@@ -140,7 +141,8 @@ static enum ANASTASIS_AUTHORIZATION_Result
 file_process (struct ANASTASIS_AUTHORIZATION_State *as,
               struct MHD_Connection *connection)
 {
-  MHD_RESULT_Result mres;
+  MHD_RESULT mres;
+  struct MHD_Response *foobar;
   FILE *f = fopen (as->data, "w");
 
   if (f == NULL)
@@ -155,6 +157,7 @@ file_process (struct ANASTASIS_AUTHORIZATION_State *as,
   {
     fclose (f);
     mres = MHD_queue_response (connection,
+                               MHD_NO,
                                foobar);
     if (MHD_YES != mres)
       return ANASTASIS_AUTHORIZATION_RES_FAILED_REPLY_FAILED;
@@ -162,6 +165,7 @@ file_process (struct ANASTASIS_AUTHORIZATION_State *as,
   }
   fclose (f);
   mres = MHD_queue_response (connection,
+                             MHD_YES,
                              foobar);
   if (MHD_YES != mres)
     return ANASTASIS_AUTHORIZATION_RES_SUCCESS_REPLY_FAILED;
@@ -178,9 +182,7 @@ static void
 file_cleanup (struct ANASTASIS_AUTHORIZATION_State *as)
 {
   GNUNET_free (as->data);
-  as->data = NULL;
   GNUNET_free (as);
-  as = NULL;
 }
 
 
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index a2d5b98..6285818 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -793,15 +793,12 @@ ANASTASIS_recovery_abort (struct ANASTASIS_Recovery *r)
   if (NULL != r->solved_challenges)
   {
     GNUNET_free (r->solved_challenges);
-    r->solved_challenges = NULL;
   }
   if (NULL != r->encrypted_recovery_document)
   {
     GNUNET_free (r->encrypted_recovery_document);
-    r->encrypted_recovery_document = NULL;
   }
   GNUNET_free (r);
-  r = NULL;
 }
 
 
@@ -1278,16 +1275,13 @@ ANASTASIS_policy_destroy (struct ANASTASIS_Policy *p)
   if (NULL != p->nonces)
   {
     GNUNET_free (p->nonces);
-    p->nonces = NULL;
   }
   if (NULL != p->truths)
   {
     GNUNET_free (p->truths);
-    p->truths = NULL;
   }
 
   GNUNET_free (p);
-  p = NULL;
 }
 
 
@@ -1453,15 +1447,12 @@ policy_store_cleanup (void *cls)
   if (NULL != pss->recovery_data)
   {
     GNUNET_free (pss->recovery_data);
-    pss->recovery_data = NULL;
   }
   if (NULL != pss->payment_order_id)
   {
     GNUNET_free (pss->payment_order_id);
-    pss->payment_order_id = NULL;
   }
   GNUNET_free (pss);
-  pss = NULL;
 }
 
 
@@ -1936,7 +1927,6 @@ ANASTASIS_secret_share (struct GNUNET_CURL_Context *ctx,
                                                 &ss->pss[l]->recovery_data,
                                                 
&ss->pss[l]->recovery_data_size);
     GNUNET_free (recovery_document_str);
-    recovery_document_str = NULL;
     // hash recovery data
     GNUNET_CRYPTO_hash (ss->pss[l]->recovery_data,
                         ss->pss[l]->recovery_data_size,
@@ -1985,11 +1975,9 @@ ANASTASIS_secret_share_cancel (struct 
ANASTASIS_SecretShare *ss)
         if (NULL != ss->pss[i])
         {
           GNUNET_free (ss->pss[i]);
-          ss->pss[i] = NULL;
         }
       }
     }
     GNUNET_free (ss);
-    ss = NULL;
   }
 }
diff --git a/src/lib/anastasis_api_policy_store.c 
b/src/lib/anastasis_api_policy_store.c
index 61903d9..ad9a839 100644
--- a/src/lib/anastasis_api_policy_store.c
+++ b/src/lib/anastasis_api_policy_store.c
@@ -93,15 +93,12 @@ ANASTASIS_policy_store_cancel (struct
   if (NULL != pso->pay_uri)
   {
     GNUNET_free (pso->pay_uri);
-    pso->pay_uri = NULL;
   }
   if (NULL != pso->url)
   {
     GNUNET_free (pso->url);
-    pso->url = NULL;
   }
   GNUNET_free (pso);
-  pso = NULL;
 }
 
 
diff --git a/src/lib/testing_api_cmd_truth_store.c 
b/src/lib/testing_api_cmd_truth_store.c
index 46ef43f..1bba214 100644
--- a/src/lib/testing_api_cmd_truth_store.c
+++ b/src/lib/testing_api_cmd_truth_store.c
@@ -310,10 +310,8 @@ truth_store_cleanup (void *cls,
   if (NULL != tss->payment_order_id)
   {
     GNUNET_free (tss->payment_order_id);
-    tss->payment_order_id = NULL;
   }
   GNUNET_free (tss);
-  tss = NULL;
 }
 
 
diff --git a/src/lib/testing_cmd_policy_create.c 
b/src/lib/testing_cmd_policy_create.c
index c685ade..287ddba 100644
--- a/src/lib/testing_cmd_policy_create.c
+++ b/src/lib/testing_cmd_policy_create.c
@@ -145,7 +145,6 @@ policy_create_cleanup (void *cls,
   GNUNET_free (pcs->cmd_label_array);
   ANASTASIS_policy_destroy (pcs->policy);
   GNUNET_free (pcs);
-  pcs = NULL;
 }
 
 
diff --git a/src/lib/testing_cmd_recover_secret.c 
b/src/lib/testing_cmd_recover_secret.c
index 66a44ad..93c86ed 100644
--- a/src/lib/testing_cmd_recover_secret.c
+++ b/src/lib/testing_cmd_recover_secret.c
@@ -225,7 +225,6 @@ recover_secret_cleanup (void *cls,
   GNUNET_free (rss->ri->dps);
   GNUNET_free (rss->ri);
   GNUNET_free (rss);
-  rss = NULL;
 }
 
 
diff --git a/src/lib/testing_cmd_secret_share.c 
b/src/lib/testing_cmd_secret_share.c
index 81bbc38..c63b83b 100644
--- a/src/lib/testing_cmd_secret_share.c
+++ b/src/lib/testing_cmd_secret_share.c
@@ -110,7 +110,7 @@ struct SecretShareState
   /**
    * Payment order ID we got back, if any. Otherwise NULL.
    */
-  const char *payment_order_id;
+  char *payment_order_id;
 };
 
 
@@ -319,7 +319,7 @@ secret_share_run (void *cls,
       TALER_TESTING_interpreter_fail (sss->is);
       return;
     }
-    sss->payment_order_id = order_id;
+    sss->payment_order_id = (char *) order_id;
 
     if (NULL == sss->payment_order_id)
     {
@@ -343,8 +343,10 @@ secret_share_run (void *cls,
     {
       GNUNET_break (0);
       TALER_TESTING_interpreter_fail (sss->is);
+      GNUNET_free (sss->payment_order_id);
       return;
     }
+    GNUNET_free (sss->payment_order_id);
     pds[0].provider_url = sss->anastasis_url;
     pds_len = 1;
   }
@@ -391,16 +393,13 @@ secret_share_cleanup (void *cls,
   if (NULL != sss->cmd_label_array)
   {
     GNUNET_free (sss->cmd_label_array);
-    sss->cmd_label_array = NULL;
   }
   if (NULL != sss->sso)
   {
     GNUNET_free (sss->sso);
-    sss->sso = NULL;
   }
   json_decref ((json_t *) sss->id_data);
   GNUNET_free (sss);
-  sss = NULL;
 }
 
 
diff --git a/src/lib/testing_cmd_truth_upload.c 
b/src/lib/testing_cmd_truth_upload.c
index b73bbc4..792a7b0 100644
--- a/src/lib/testing_cmd_truth_upload.c
+++ b/src/lib/testing_cmd_truth_upload.c
@@ -248,7 +248,6 @@ truth_upload_cleanup (void *cls,
   if (NULL != tus->truth)
   {
     GNUNET_free (tus->truth);
-    tus->truth = NULL;
   }
   GNUNET_free (tus);
 }
diff --git a/src/stasis/anastasis_db_plugin.c b/src/stasis/anastasis_db_plugin.c
index db46ab8..2da2037 100644
--- a/src/stasis/anastasis_db_plugin.c
+++ b/src/stasis/anastasis_db_plugin.c
@@ -54,7 +54,6 @@ ANASTASIS_DB_plugin_load (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
                           "libanastasis_plugin_db_%s",
                           plugin_name);
   GNUNET_free (plugin_name);
-  plugin_name = NULL;
   cfg_dup = GNUNET_CONFIGURATION_dup (cfg);
   plugin = GNUNET_PLUGIN_load (lib_name, cfg_dup);
   if (NULL != plugin)
@@ -82,7 +81,6 @@ ANASTASIS_DB_plugin_unload (struct ANASTASIS_DatabasePlugin 
*plugin)
   GNUNET_assert (NULL == GNUNET_PLUGIN_unload (lib_name,
                                                plugin));
   GNUNET_free (lib_name);
-  lib_name = NULL;
 }
 
 
@@ -143,7 +141,6 @@ plugin_fini ()
   if (NULL != old_dlsearchpath)
   {
     GNUNET_free (old_dlsearchpath);
-    old_dlsearchpath = NULL;
   }
   lt_dlexit ();
 }
diff --git a/src/stasis/test_anastasis_db.c b/src/stasis/test_anastasis_db.c
index 1b4bd1e..57252c1 100644
--- a/src/stasis/test_anastasis_db.c
+++ b/src/stasis/test_anastasis_db.c
@@ -222,7 +222,6 @@ run (void *cls)
                        &key_share,
                        sizeof (key_share)));
   GNUNET_free (res_key_share);
-  res_key_share = NULL;
 
   FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->get_recovery_document (plugin->cls,
@@ -236,7 +235,6 @@ run (void *cls)
                        recovery_data,
                        strlen (recovery_data)));
   GNUNET_free (res_recovery_data);
-  res_recovery_data = NULL;
 
   FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->get_latest_recovery_document (plugin->cls,
@@ -250,8 +248,6 @@ run (void *cls)
                        recovery_data,
                        strlen (recovery_data)));
   GNUNET_free (res_recovery_data);
-  res_recovery_data = NULL;
-
 
   FAILIF (ANASTASIS_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->store_challenge_code (plugin->cls,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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