View Issue Details

IDProjectCategoryView StatusLast Update
0007653GNUnetcore servicepublic2023-06-01 20:26
Reporterulfvonbelow Assigned Toschanzen  
PrioritynormalSeveritytrivialReproducibilityalways
Status closedResolutionfixed 
Product VersionGit master 
Target Version0.19.4Fixed in Version0.19.4 
Summary0007653: Memory leak in test_core_quota_compliance
Descriptionin process_hello, p->hello is overwritten without checking whether it needs to be freed first.
Steps To Reproduce./configure --enable-sanitizer
make
make install
make check
Additional InformationPatch attached.

With this final patch, the test suite fully passes (aside from a few nondeterministic failures if you've got a busy, slow hard drive like me) with sanitizers fully enabled. Meaning we can keep them enabled for future test runs \o/.
Tagspatch
Attached Files
0001-CORE-fix-memory-leak-in-test.patch (934 bytes)   
From 2addaf87037b6ec138d64abf71e17719a3a131a2 Mon Sep 17 00:00:00 2001
From: ulfvonbelow <strilen@tilde.club>
Date: Sun, 29 Jan 2023 07:10:47 -0600
Subject: [PATCH] -CORE: fix memory leak in test.

This allows us to use sanitizers to find bugs that matter.
---
 src/core/test_core_quota_compliance.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index eb5ca7c2b..099c6fa3b 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -530,6 +530,7 @@ process_hello (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Received (my) HELLO from transport service\n");
   GNUNET_assert (message != NULL);
+  if (NULL != p->hello) GNUNET_free (p->hello);
   p->hello = GNUNET_malloc (ntohs (message->size));
   GNUNET_memcpy (p->hello, message, ntohs (message->size));
   if ((p == &p1) &&
-- 
2.38.1

Activities

schanzen

2023-02-06 05:52

administrator   ~0019762

Thank you very much. Please send a mail if you want to continue hacking and need commit rights to either the mailing list or privately.

schanzen

2023-06-01 20:26

administrator   ~0020217

released some time ago

Issue History

Date Modified Username Field Change
2023-01-30 00:50 ulfvonbelow New Issue
2023-01-30 00:50 ulfvonbelow Tag Attached: patch
2023-01-30 00:50 ulfvonbelow File Added: 0001-CORE-fix-memory-leak-in-test.patch
2023-02-06 05:52 schanzen Assigned To => schanzen
2023-02-06 05:52 schanzen Status new => resolved
2023-02-06 05:52 schanzen Resolution open => fixed
2023-02-06 05:52 schanzen Fixed in Version => 0.19.4
2023-02-06 05:52 schanzen Note Added: 0019762
2023-02-06 06:19 schanzen Target Version => 0.19.4
2023-06-01 20:26 schanzen Note Added: 0020217
2023-06-01 20:26 schanzen Status resolved => closed