commit 9719babb53912f2523205238962b91f35359e42b
parent 3f4464acd8bf854ec4c32c80e6f4852e20511cdd
Author: ulfvonbelow <strilen@tilde.club>
Date: Sun, 29 Jan 2023 06:15:57 -0600
-RECLAIM: fix memory leaks in tests.
This makes the sanitizers happy so we can find the bugs that matter.
Signed-off-by: Martin Schanzenbach <schanzen@gnunet.org>
Diffstat:
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git 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
@@ -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);
}