diff options
author | ulfvonbelow <strilen@tilde.club> | 2023-01-29 06:15:57 -0600 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2023-02-06 14:10:13 +0900 |
commit | 9719babb53912f2523205238962b91f35359e42b (patch) | |
tree | be322a61c6e254c2870dfc9be85790c48a83c1b2 | |
parent | 3f4464acd8bf854ec4c32c80e6f4852e20511cdd (diff) | |
download | gnunet-9719babb53912f2523205238962b91f35359e42b.tar.gz gnunet-9719babb53912f2523205238962b91f35359e42b.zip |
-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>
-rw-r--r-- | src/reclaim/test_did_helper.c | 5 | ||||
-rw-r--r-- | src/reclaim/test_reclaim_attribute.c | 1 |
2 files changed, 6 insertions, 0 deletions
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 () | |||
69 | char *str_did; | 69 | char *str_did; |
70 | str_did = DID_pkey_to_did (&test_pkey); | 70 | str_did = DID_pkey_to_did (&test_pkey); |
71 | GNUNET_assert (strcmp ((char *) test_did, str_did) == 0); | 71 | GNUNET_assert (strcmp ((char *) test_did, str_did) == 0); |
72 | GNUNET_free (str_did); | ||
72 | } | 73 | } |
73 | 74 | ||
74 | void | 75 | void |
@@ -93,6 +94,7 @@ test_GNUNET_DID_key_convert_gnunet_to_multibase_base64 () | |||
93 | multibase_key = DID_key_convert_gnunet_to_multibase_base64 (&test_pkey); | 94 | multibase_key = DID_key_convert_gnunet_to_multibase_base64 (&test_pkey); |
94 | 95 | ||
95 | GNUNET_assert (strcmp (test_multibase_key, multibase_key) == 0); | 96 | GNUNET_assert (strcmp (test_multibase_key, multibase_key) == 0); |
97 | GNUNET_free (multibase_key); | ||
96 | } | 98 | } |
97 | 99 | ||
98 | void | 100 | void |
@@ -102,6 +104,8 @@ test_GNUNET_DID_pkey_to_did_document () | |||
102 | char *did_document_str = DID_pkey_to_did_document (&test_pkey); | 104 | char *did_document_str = DID_pkey_to_did_document (&test_pkey); |
103 | did_document = json_loads (did_document_str, JSON_DECODE_ANY, NULL); | 105 | did_document = json_loads (did_document_str, JSON_DECODE_ANY, NULL); |
104 | GNUNET_assert (json_equal (test_did_document, did_document) == 1); | 106 | GNUNET_assert (json_equal (test_did_document, did_document) == 1); |
107 | json_decref (did_document); | ||
108 | GNUNET_free (did_document_str); | ||
105 | } | 109 | } |
106 | 110 | ||
107 | int | 111 | int |
@@ -128,5 +132,6 @@ main () | |||
128 | test_GNUNET_DID_did_to_pkey (); | 132 | test_GNUNET_DID_did_to_pkey (); |
129 | test_GNUNET_DID_pkey_to_did_document (); | 133 | test_GNUNET_DID_pkey_to_did_document (); |
130 | test_GNUNET_DID_key_convert_gnunet_to_multibase_base64 (); | 134 | test_GNUNET_DID_key_convert_gnunet_to_multibase_base64 (); |
135 | json_decref (test_did_document); | ||
131 | return 0; | 136 | return 0; |
132 | } | 137 | } |
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[]) | |||
45 | //GNUNET_assert (-1 != deser_len); | 45 | //GNUNET_assert (-1 != deser_len); |
46 | GNUNET_free (ser_data); | 46 | GNUNET_free (ser_data); |
47 | GNUNET_RECLAIM_attribute_list_destroy (al); | 47 | GNUNET_RECLAIM_attribute_list_destroy (al); |
48 | GNUNET_RECLAIM_attribute_list_destroy (al_two); | ||
48 | } | 49 | } |