View Issue Details

IDProjectCategoryView StatusLast Update
0008811GNUnettransport servicepublic2024-05-13 10:50
Reporterulfvonbelow Assigned Toschanzen  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86-64OSGuix SystemOS Versiona1d711c92e
Product VersionGit master 
Fixed in Version0.21.2 
Summary0008811: struct SharedSecret not cleaned up when destroying sender or receiver in udp communicator
DescriptionNeither receiver_destroy nor sender_destroy call secret_destroy.
Steps To Reproduce1. Build gnunet with --enable-sanitizer
2. Start the node with gnunet-arm -s
3. Stop the node after a bit with gnunet-arm -e
4. Observe reported memory leak wherever you've configured communicator-udp to log to
Additional InformationPatch attached.
TagsNo tags attached.
Attached Files
0001-transport-clean-up-SharedSecrets-in-gnunet-communica.patch (2,101 bytes)   
From c8ee6c3444ffe00fbe7c5257ed380c439b4ef117 Mon Sep 17 00:00:00 2001
From: ulfvonbelow <striness@tilde.club>
Date: Sun, 5 May 2024 00:59:06 -0500
Subject: [PATCH] transport: clean up SharedSecrets in gnunet-communicator-udp.

---
 src/service/transport/gnunet-communicator-udp.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/service/transport/gnunet-communicator-udp.c b/src/service/transport/gnunet-communicator-udp.c
index e9496c571..2a2f3a409 100644
--- a/src/service/transport/gnunet-communicator-udp.c
+++ b/src/service/transport/gnunet-communicator-udp.c
@@ -883,6 +883,8 @@ bi_destroy (struct BroadcastInterface *bi)
   GNUNET_free (bi);
 }
 
+static int
+secret_destroy (struct SharedSecret *ss);
 
 /**
  * Destroys a receiving state due to timeout or shutdown.
@@ -892,7 +894,7 @@ bi_destroy (struct BroadcastInterface *bi)
 static void
 receiver_destroy (struct ReceiverAddress *receiver)
 {
-
+  struct SharedSecret *ss;
   receiver->receiver_destroy_called = GNUNET_YES;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -918,6 +920,10 @@ receiver_destroy (struct ReceiverAddress *receiver)
                          "# receivers active",
                          GNUNET_CONTAINER_multihashmap_size (receivers),
                          GNUNET_NO);
+  while (NULL != (ss = receiver->ss_head))
+  {
+    secret_destroy (ss);
+  }
   GNUNET_free (receiver->address);
   GNUNET_free (receiver->foreign_addr);
   GNUNET_free (receiver);
@@ -1065,6 +1071,7 @@ secret_destroy (struct SharedSecret *ss)
 static void
 sender_destroy (struct SenderAddress *sender)
 {
+  struct SharedSecret *ss;
   sender->sender_destroy_called = GNUNET_YES;
   GNUNET_assert (
     GNUNET_YES ==
@@ -1074,6 +1081,10 @@ sender_destroy (struct SenderAddress *sender)
                          "# senders active",
                          GNUNET_CONTAINER_multihashmap_size (senders),
                          GNUNET_NO);
+  while (NULL != (ss = sender->ss_head))
+  {
+    secret_destroy (ss);
+  }
   GNUNET_free (sender->address);
   GNUNET_free (sender);
 }
-- 
2.41.0

Activities

schanzen

2024-05-13 10:50

administrator   ~0022395

If you don't mind can you sign the CA to receive commit rights in order to apply such fixes yourself?
This way of doing things is rather inefficient for most of the patches you send and most of them look good and uncontroversial anyway.
I rarely have to reassign or modify the solution.

Thanks

Issue History

Date Modified Username Field Change
2024-05-07 05:31 ulfvonbelow New Issue
2024-05-07 05:31 ulfvonbelow File Added: 0001-transport-clean-up-SharedSecrets-in-gnunet-communica.patch
2024-05-13 10:50 schanzen Assigned To => schanzen
2024-05-13 10:50 schanzen Status new => resolved
2024-05-13 10:50 schanzen Resolution open => fixed
2024-05-13 10:50 schanzen Fixed in Version => 0.21.2
2024-05-13 10:50 schanzen Note Added: 0022395