View Issue Details

IDProjectCategoryView StatusLast Update
0007624GNUnetset servicepublic2024-02-29 22:46
Reporterulfvonbelow Assigned ToFlorian Dold  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product VersionGit master 
Target Version0.19.4Fixed in Version0.19.4 
Summary0007624: Memory leak in gnunet-service-setu
DescriptionNo attempt is made to free either of the multihashmaps message_control_flow or inquiries_sent for each operation.
Steps To Reproduce./configure --enable-sanitizer
make
make install
make check
Additional InformationPatch attached.
Tagsmemory-leak, patch
Attached Files
0001-SETU-don-t-leak-Operation.-message_control_flow-inqu.patch (1,622 bytes)   
From 942b52ea891833b0c79880f428f1619d2cceb43d Mon Sep 17 00:00:00 2001
From: ulfvonbelow <strilen@tilde.club>
Date: Sun, 29 Jan 2023 05:37:34 -0600
Subject: [PATCH] SETU: don't leak
 Operation.{message_control_flow,inquiries_sent}.

---
 src/setu/gnunet-service-setu.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index 339d347f8..ba32af577 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -1552,6 +1552,16 @@ check_byzantine_bounds (struct Operation *op)
 }
 
 
+static enum GNUNET_GenericReturnValue
+free_values_iter(void *cls,
+                 const struct GNUNET_HashCode *key,
+                 void *value)
+{
+  GNUNET_free (value);
+  return GNUNET_YES;
+}
+
+
 /* FIXME: the destroy logic is a mess and should be cleaned up! */
 
 /**
@@ -1605,6 +1615,19 @@ _GSS_operation_destroy (struct Operation *op)
     GNUNET_CONTAINER_multihashmap32_destroy (op->key_to_element);
     op->key_to_element = NULL;
   }
+  if (NULL != op->message_control_flow)
+  {
+    GNUNET_CONTAINER_multihashmap_iterate (op->message_control_flow,
+                                           &free_values_iter,
+                                           NULL);
+    GNUNET_CONTAINER_multihashmap_destroy (op->message_control_flow);
+    op->message_control_flow = NULL;
+  }
+  if (NULL != op->inquiries_sent)
+  {
+    GNUNET_CONTAINER_multihashmap_destroy (op->inquiries_sent);
+    op->inquiries_sent = NULL;
+  }
   if (NULL != set)
   {
     GNUNET_CONTAINER_DLL_remove (set->ops_head,
-- 
2.38.1

Activities

schanzen

2023-06-01 20:26

administrator   ~0020239

released some time ago

Issue History

Date Modified Username Field Change
2023-01-29 21:18 ulfvonbelow New Issue
2023-01-29 21:18 ulfvonbelow Status new => assigned
2023-01-29 21:18 ulfvonbelow Assigned To => Florian Dold
2023-01-29 21:18 ulfvonbelow Tag Attached: bug
2023-01-29 21:18 ulfvonbelow Tag Attached: memory-leak
2023-01-29 21:18 ulfvonbelow Tag Attached: patch
2023-01-29 21:18 ulfvonbelow File Added: 0001-SETU-don-t-leak-Operation.-message_control_flow-inqu.patch
2023-02-06 06:18 schanzen Status assigned => resolved
2023-02-06 06:18 schanzen Resolution open => fixed
2023-02-06 06:18 schanzen Fixed in Version => 0.19.4
2023-02-06 06:19 schanzen Target Version => 0.19.4
2023-06-01 20:26 schanzen Note Added: 0020239
2023-06-01 20:26 schanzen Status resolved => closed
2024-02-29 22:46 Christian Grothoff Tag Detached: bug