gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 02/07: peerstore: fix Iteration memory leak in gnunet-service-p


From: gnunet
Subject: [gnunet] 02/07: peerstore: fix Iteration memory leak in gnunet-service-peerstore.
Date: Mon, 13 May 2024 10:51:39 +0200

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

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

commit 613cc0cb6b1e66ee13b3f1a1b11972a10ac11ab6
Author: ulfvonbelow <striness@tilde.club>
AuthorDate: Sat May 4 18:09:51 2024 -0500

    peerstore: fix Iteration memory leak in gnunet-service-peerstore.
    
    Signed-off-by: Martin Schanzenbach <schanzen@gnunet.org>
---
 src/service/peerstore/gnunet-service-peerstore.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/service/peerstore/gnunet-service-peerstore.c 
b/src/service/peerstore/gnunet-service-peerstore.c
index 5d0f037a1..3eb224ae8 100644
--- a/src/service/peerstore/gnunet-service-peerstore.c
+++ b/src/service/peerstore/gnunet-service-peerstore.c
@@ -491,6 +491,15 @@ iterate_proc (void *cls,
   proc->limit--;
 }
 
+
+static void destroy_iteration(struct Iteration *ic)
+{
+  GNUNET_free (ic->key);
+  GNUNET_free (ic->sub_system);
+  GNUNET_free (ic);
+}
+
+
 /**
  * Function called once we are done with the iteration and
  * allow the zone iteration client to send us more messages.
@@ -512,10 +521,8 @@ iteration_done_client_continue (struct Iteration *ic)
   endmsg->rid = htons (ic->request_id);
   endmsg->result = htonl (GNUNET_OK);
   GNUNET_MQ_send (ic->pc->mq, env);
-  GNUNET_free (ic->key);
-  GNUNET_free (ic->sub_system);
   GNUNET_CONTAINER_DLL_remove (ic->pc->op_head, ic->pc->op_tail, ic);
-  GNUNET_free (ic);
+  destroy_iteration (ic);
   return;
 }
 
@@ -657,7 +664,7 @@ handle_iterate_stop (void *cls,
     return;
   }
   GNUNET_CONTAINER_DLL_remove (pc->op_head, pc->op_tail, ic);
-  GNUNET_free (ic);
+  destroy_iteration (ic);
   GNUNET_SERVICE_client_continue (pc->client);
 }
 
@@ -1098,7 +1105,7 @@ client_disconnect_cb (void *cls,
   while (NULL != (iter = pc->op_head))
   {
     GNUNET_CONTAINER_DLL_remove (pc->op_head, pc->op_tail, iter);
-    GNUNET_free (iter);
+    destroy_iteration (iter);
   }
   GNUNET_free (pc);
 }

-- 
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]