View Issue Details

IDProjectCategoryView StatusLast Update
0007636GNUnetreclaimpublic2023-06-01 20:26
Reporterulfvonbelow Assigned Toschanzen  
PrioritynormalSeveritytrivialReproducibilityalways
Status closedResolutionfixed 
Product VersionGit master 
Target Version0.19.4Fixed in Version0.19.4 
Summary0007636: Memory leaks in test_did_helper
DescriptionLots of things aren't freed, see patch.
Steps To Reproduce./configure --enable-sanitizer
make
make install
make check
Additional InformationI get that these aren't "real" memory leaks, since it's all one-off stuff only used in a test case anyway, but it does make it harder to find the real ones.
Patch attached.
Tagsmemory-leak, patch
Attached Files
0001-RECLAIM-fix-memory-leaks-in-tests.patch (2,058 bytes)   
From 2b2da6504f09d21b7adf03073766614914868b57 Mon Sep 17 00:00:00 2001
From: ulfvonbelow <strilen@tilde.club>
Date: Sun, 29 Jan 2023 06:15:57 -0600
Subject: [PATCH] -RECLAIM: fix memory leaks in tests.

This makes the sanitizers happy so we can find the bugs that matter.
---
 src/reclaim/test_did_helper.c        | 5 +++++
 src/reclaim/test_reclaim_attribute.c | 1 +
 2 files changed, 6 insertions(+)

diff --git a/src/reclaim/test_did_helper.c b/src/reclaim/test_did_helper.c
index c7c6f3110..02db28925 100644
--- a/src/reclaim/test_did_helper.c
+++ b/src/reclaim/test_did_helper.c
@@ -69,6 +69,7 @@ test_GNUNET_DID_pkey_to_did ()
   char *str_did;
   str_did = DID_pkey_to_did (&test_pkey);
   GNUNET_assert (strcmp ((char *) test_did, str_did) == 0);
+  GNUNET_free (str_did);
 }
 
 void
@@ -93,6 +94,7 @@ test_GNUNET_DID_key_convert_gnunet_to_multibase_base64 ()
   multibase_key = DID_key_convert_gnunet_to_multibase_base64 (&test_pkey);
 
   GNUNET_assert (strcmp (test_multibase_key, multibase_key) == 0);
+  GNUNET_free (multibase_key);
 }
 
 void
@@ -102,6 +104,8 @@ test_GNUNET_DID_pkey_to_did_document ()
   char *did_document_str = DID_pkey_to_did_document (&test_pkey);
   did_document = json_loads (did_document_str, JSON_DECODE_ANY, NULL);
   GNUNET_assert (json_equal (test_did_document, did_document) == 1);
+  json_decref (did_document);
+  GNUNET_free (did_document_str);
 }
 
 int
@@ -128,5 +132,6 @@ main ()
   test_GNUNET_DID_did_to_pkey ();
   test_GNUNET_DID_pkey_to_did_document ();
   test_GNUNET_DID_key_convert_gnunet_to_multibase_base64 ();
+  json_decref (test_did_document);
   return 0;
 }
diff --git a/src/reclaim/test_reclaim_attribute.c b/src/reclaim/test_reclaim_attribute.c
index 0740812eb..acbcda62d 100644
--- a/src/reclaim/test_reclaim_attribute.c
+++ b/src/reclaim/test_reclaim_attribute.c
@@ -45,4 +45,5 @@ main (int argc, char *argv[])
   //GNUNET_assert (-1 != deser_len);
   GNUNET_free (ser_data);
   GNUNET_RECLAIM_attribute_list_destroy (al);
+  GNUNET_RECLAIM_attribute_list_destroy (al_two);
 }
-- 
2.38.1

Activities

schanzen

2023-06-01 20:26

administrator   ~0020231

released some time ago

Issue History

Date Modified Username Field Change
2023-01-29 22:35 ulfvonbelow New Issue
2023-01-29 22:35 ulfvonbelow Tag Attached: memory-leak
2023-01-29 22:35 ulfvonbelow Tag Attached: patch
2023-01-29 22:35 ulfvonbelow File Added: 0001-RECLAIM-fix-memory-leaks-in-tests.patch
2023-02-06 06:10 schanzen Assigned To => schanzen
2023-02-06 06:10 schanzen Status new => resolved
2023-02-06 06:10 schanzen Resolution open => fixed
2023-02-06 06:10 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: 0020231
2023-06-01 20:26 schanzen Status resolved => closed