View Issue Details

IDProjectCategoryView StatusLast Update
0007644GNUnetotherpublic2023-06-01 20:26
Reporterulfvonbelow Assigned Toschanzen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product VersionGit master 
Target Version0.19.4Fixed in Version0.19.4 
Summary0007644: Memory leaks in json tests
Descriptionjson_decref needs to be added in test_raw, test_rsa, and test_boolean.
Steps To Reproduce./configure --enable-sanitizer
make
make install
make check
Additional InformationPatch attached.
Tagspatch
Attached Files
0001-JSON-fix-memory-leaks-in-test.patch (1,296 bytes)   
From 50819bf46c0618566ffc44a0ccedf047af7da073 Mon Sep 17 00:00:00 2001
From: ulfvonbelow <strilen@tilde.club>
Date: Sun, 29 Jan 2023 06:49:28 -0600
Subject: [PATCH] JSON: fix memory leaks in test.

This allows us to use sanitizers to find bugs that matter.
---
 src/json/test_json.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/json/test_json.c b/src/json/test_json.c
index d6c372cf3..db376d213 100644
--- a/src/json/test_json.c
+++ b/src/json/test_json.c
@@ -141,6 +141,7 @@ test_raw ()
     GNUNET_assert (NULL != j);
     GNUNET_assert (GNUNET_OK == GNUNET_JSON_parse (j, spec, NULL, NULL));
     GNUNET_assert (0 == memcmp (blob, blob2, i));
+    json_decref (j);
   }
   return 0;
 }
@@ -177,6 +178,8 @@ test_rsa ()
   GNUNET_assert (GNUNET_OK == GNUNET_JSON_parse (js, sspec, NULL, NULL));
   GNUNET_break (0 == GNUNET_CRYPTO_rsa_signature_cmp (sig, sig2));
   GNUNET_break (0 == GNUNET_CRYPTO_rsa_public_key_cmp (pub, pub2));
+  json_decref (jp);
+  json_decref (js);
   GNUNET_CRYPTO_rsa_signature_free (sig);
   GNUNET_CRYPTO_rsa_signature_free (sig2);
   GNUNET_CRYPTO_rsa_private_key_free (priv);
@@ -216,6 +219,8 @@ test_boolean ()
 
   GNUNET_assert (GNUNET_OK != GNUNET_JSON_parse (json, pspec, NULL, NULL));
 
+  json_decref (json);
+
   return 0;
 }
 
-- 
2.38.1

Activities

schanzen

2023-06-01 20:26

administrator   ~0020224

released some time ago

Issue History

Date Modified Username Field Change
2023-01-29 23:39 ulfvonbelow New Issue
2023-01-29 23:39 ulfvonbelow Tag Attached: patch
2023-01-29 23:39 ulfvonbelow File Added: 0001-JSON-fix-memory-leaks-in-test.patch
2023-02-06 05:59 schanzen Assigned To => schanzen
2023-02-06 05:59 schanzen Status new => resolved
2023-02-06 05:59 schanzen Resolution open => fixed
2023-02-06 05:59 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: 0020224
2023-06-01 20:26 schanzen Status resolved => closed