From 50819bf46c0618566ffc44a0ccedf047af7da073 Mon Sep 17 00:00:00 2001 From: ulfvonbelow 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