View Issue Details

IDProjectCategoryView StatusLast Update
0007639GNUnetNAT traversal librarypublic2024-02-29 22:46
Reporterulfvonbelow Assigned Toschanzen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product VersionGit master 
Target Version0.19.4Fixed in Version0.19.4 
Summary0007639: Memory leak in GNUNET_NAT_unregister
DescriptionAddrEntries aren't freed.
Steps To Reproduce./configure --enable-sanitizer
make
make install
make check
Additional InformationPatch attached.
Tagsmemory-leak, patch
Attached Files
0001-NAT-don-t-leak-AddrEntries-when-unregistering.patch (1,088 bytes)   
From b20fa51519586affb21fd8591a6f97a234fa7b3c Mon Sep 17 00:00:00 2001
From: ulfvonbelow <strilen@tilde.club>
Date: Sun, 29 Jan 2023 06:21:24 -0600
Subject: [PATCH] NAT: don't leak AddrEntries when unregistering.

---
 src/nat/nat_api.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/nat/nat_api.c b/src/nat/nat_api.c
index 3072cff7f..31f8f388d 100644
--- a/src/nat/nat_api.c
+++ b/src/nat/nat_api.c
@@ -673,6 +673,9 @@ GNUNET_NAT_request_reversal (struct GNUNET_NAT_Handle *nh,
 void
 GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *nh)
 {
+  struct AddrEntry *ae;
+  struct AddrEntry *next;
+
   if (NULL != nh->mq)
   {
     GNUNET_MQ_destroy (nh->mq);
@@ -683,6 +686,14 @@ GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *nh)
     GNUNET_SCHEDULER_cancel (nh->reconnect_task);
     nh->reconnect_task = NULL;
   }
+  next = nh->ae_head;
+  while (NULL != next)
+  {
+    ae = next;
+    next = next->next;
+    GNUNET_CONTAINER_DLL_remove (nh->ae_head, nh->ae_tail, ae);
+    GNUNET_free (ae);
+  }
   GNUNET_free (nh->reg);
   GNUNET_free (nh);
 }
-- 
2.38.1

Activities

schanzen

2023-06-01 20:26

administrator   ~0020229

released some time ago

Issue History

Date Modified Username Field Change
2023-01-29 23:38 ulfvonbelow New Issue
2023-01-29 23:38 ulfvonbelow Tag Attached: bug
2023-01-29 23:38 ulfvonbelow Tag Attached: memory-leak
2023-01-29 23:38 ulfvonbelow Tag Attached: patch
2023-01-29 23:38 ulfvonbelow File Added: 0001-NAT-don-t-leak-AddrEntries-when-unregistering.patch
2023-02-06 05:50 schanzen Assigned To => schanzen
2023-02-06 05:50 schanzen Status new => resolved
2023-02-06 05:50 schanzen Resolution open => fixed
2023-02-06 05:50 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: 0020229
2023-06-01 20:26 schanzen Status resolved => closed
2024-02-29 22:46 Christian Grothoff Tag Detached: bug