View Issue Details

IDProjectCategoryView StatusLast Update
0008815GNUnettransport servicepublic2024-05-13 10:40
Reporterulfvonbelow Assigned Toschanzen  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86-64OSGuix SystemOS Versiona1d711c92e
Product VersionGit master 
Fixed in Version0.21.2 
Summary0008815: ReceiverAddress.d_mq isn't destroyed if it hasn't yet been registered in udp communicator
DescriptionBoth d_mq and kx_mq are created when the ReceiverAddress is, and kx_mq is immediately registered with the transport api, while d_mq is only registered after the key exchange has completed. Once registered, the transport api takes over the lifetime of the mq, and it is indirectly destroyed via GNUNET_TRANSPORT_communicator_mq_del. If receiver_destroy is called before then, though, d_mq is leaked.
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-manually-destroy-d_mq-if-not-yet-registere.patch (1,036 bytes)   
From bcf3dadf62d3abbfa6a1febf7f65461b452fd336 Mon Sep 17 00:00:00 2001
From: ulfvonbelow <striness@tilde.club>
Date: Sun, 5 May 2024 12:03:28 -0500
Subject: [PATCH] transport: manually destroy d_mq if not yet registered.

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

diff --git a/src/service/transport/gnunet-communicator-udp.c b/src/service/transport/gnunet-communicator-udp.c
index 938e53670..fa5294218 100644
--- a/src/service/transport/gnunet-communicator-udp.c
+++ b/src/service/transport/gnunet-communicator-udp.c
@@ -911,6 +911,11 @@ receiver_destroy (struct ReceiverAddress *receiver)
     GNUNET_TRANSPORT_communicator_mq_del (receiver->d_qh);
     receiver->d_qh = NULL;
   }
+  else if (NULL != receiver->d_mq)
+  {
+    GNUNET_MQ_destroy (receiver->d_mq);
+    receiver->d_mq = NULL;
+  }
   GNUNET_assert (GNUNET_YES ==
                  GNUNET_CONTAINER_multihashmap_remove (receivers,
                                                        &receiver->key,
-- 
2.41.0

Activities

schanzen

2024-05-13 10:40

administrator   ~0022386

Applied

Issue History

Date Modified Username Field Change
2024-05-07 06:03 ulfvonbelow New Issue
2024-05-07 06:03 ulfvonbelow File Added: 0001-transport-manually-destroy-d_mq-if-not-yet-registere.patch
2024-05-13 10:40 schanzen Assigned To => schanzen
2024-05-13 10:40 schanzen Status new => resolved
2024-05-13 10:40 schanzen Resolution open => fixed
2024-05-13 10:40 schanzen Fixed in Version => 0.21.2
2024-05-13 10:40 schanzen Note Added: 0022386