gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 141/164: Does this fix the mem leak


From: gnunet
Subject: [gnunet] 141/164: Does this fix the mem leak
Date: Fri, 30 Jul 2021 15:33:27 +0200

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

grothoff pushed a commit to branch master
in repository gnunet.

commit 23a93411b729011f535b1a3718da8ff67bbd4554
Author: Elias Summermatter <elias.summermatter@seccom.ch>
AuthorDate: Tue Jun 8 09:18:00 2021 +0200

    Does this fix the mem leak
---
 src/setu/gnunet-service-setu.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index 94b660a20..3e24dfe0f 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -1179,12 +1179,14 @@ update_message_control_flow (struct 
GNUNET_CONTAINER_MultiHashMap *hash_map,
 {
   struct message_control_flow_element *cfe = NULL;
   enum MESSAGE_CONTROL_FLOW_STATE *mcfs;
+  uint8_t free_cfe = GNUNET_NO;
 
   cfe = GNUNET_CONTAINER_multihashmap_get (hash_map, hash_code);
   if (NULL == cfe)
   {
     cfe = (struct message_control_flow_element*) GNUNET_malloc (sizeof(struct
                                                                        
message_control_flow_element));
+    free_cfe = GNUNET_YES;
   }
   if (OFFER_MESSAGE == mt)
   {
@@ -1199,6 +1201,8 @@ update_message_control_flow (struct 
GNUNET_CONTAINER_MultiHashMap *hash_map,
     mcfs = &cfe->element;
     if ((new_mcfs != MESSAGE_SENT) && (MESSAGE_RECEIVED != cfe->offer) )
     {
+      if(GNUNET_YES == free_cfe)
+          GNUNET_free(cfe);
       LOG (GNUNET_ERROR_TYPE_ERROR,
            "Received an element without sent offer!\n");
       return GNUNET_NO;
@@ -1206,6 +1210,8 @@ update_message_control_flow (struct 
GNUNET_CONTAINER_MultiHashMap *hash_map,
     /* Check that only requested elements are received! */
     if ((new_mcfs != MESSAGE_SENT) && (cfe->demand != MESSAGE_SENT) )
     {
+      if(GNUNET_YES == free_cfe)
+            GNUNET_free(cfe);
       LOG (GNUNET_ERROR_TYPE_ERROR,
            "Received an element that was not demanded\n");
       return GNUNET_NO;
@@ -1213,11 +1219,15 @@ update_message_control_flow (struct 
GNUNET_CONTAINER_MultiHashMap *hash_map,
   }
   else
   {
-    return GNUNET_SYSERR;
+     if(GNUNET_YES == free_cfe)
+          GNUNET_free(cfe);
+     return GNUNET_SYSERR;
   }
 
   if (new_mcfs <= *mcfs)
   {
+    if(GNUNET_YES == free_cfe)
+        GNUNET_free(cfe);
     return GNUNET_NO;
   }
 

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