View Issue Details

IDProjectCategoryView StatusLast Update
0008814GNUnettransport servicepublic2024-06-08 12:03
Reporterulfvonbelow Assigned Toschanzen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx86-64OSGuix SystemOS Versiona1d711c92e
Product VersionGit master 
Fixed in Version0.21.2 
Summary0008814: memory leaks in mq_init of both tcp and udp communicators
DescriptionIn the "queue already exists" case, the socket address 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 or communicator-tcp to log to
Additional InformationPatch attached.
TagsNo tags attached.
Attached Files
0001-transport-fix-mq_init-memory-leak-in-already-exists-.patch (1,499 bytes)   
From 2b8727abff5f9faf51f0f0647ede88a58ea90203 Mon Sep 17 00:00:00 2001
From: ulfvonbelow <striness@tilde.club>
Date: Sun, 5 May 2024 12:02:29 -0500
Subject: [PATCH] transport: fix mq_init memory leak in already-exists case.

---
 src/service/transport/gnunet-communicator-tcp.c | 1 +
 src/service/transport/gnunet-communicator-udp.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/service/transport/gnunet-communicator-tcp.c b/src/service/transport/gnunet-communicator-tcp.c
index d13473b0a..1e0d47776 100644
--- a/src/service/transport/gnunet-communicator-tcp.c
+++ b/src/service/transport/gnunet-communicator-tcp.c
@@ -3347,6 +3347,7 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Queue for %s already exists or is in construction\n", address);
+    GNUNET_free (in);
     return GNUNET_NO;
   }
   switch (in->sa_family)
diff --git a/src/service/transport/gnunet-communicator-udp.c b/src/service/transport/gnunet-communicator-udp.c
index 2a2f3a409..938e53670 100644
--- a/src/service/transport/gnunet-communicator-udp.c
+++ b/src/service/transport/gnunet-communicator-udp.c
@@ -2903,6 +2903,7 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "receiver %s already exist or is being connected to\n",
                 address);
+    GNUNET_free (in);
     return GNUNET_NO;
   }
 
-- 
2.41.0

Activities

schanzen

2024-05-13 10:41

administrator   ~0022387

Applied

schanzen

2024-06-08 12:03

administrator   ~0022540

0.21.2 released

Issue History

Date Modified Username Field Change
2024-05-07 05:41 ulfvonbelow New Issue
2024-05-07 05:41 ulfvonbelow File Added: 0001-transport-fix-mq_init-memory-leak-in-already-exists-.patch
2024-05-13 10:41 schanzen Assigned To => schanzen
2024-05-13 10:41 schanzen Status new => resolved
2024-05-13 10:41 schanzen Resolution open => fixed
2024-05-13 10:41 schanzen Fixed in Version => 0.21.2
2024-05-13 10:41 schanzen Note Added: 0022387
2024-06-08 12:03 schanzen Note Added: 0022540
2024-06-08 12:03 schanzen Status resolved => closed