diff options
author | ulfvonbelow <strilen@tilde.club> | 2023-01-29 07:05:06 -0600 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2023-02-06 13:55:53 +0900 |
commit | efad40e99f1d00b41814d9a5ee856a88e1be979e (patch) | |
tree | c30f41a07f4afee31c36d2d8751215a86be9f7ef | |
parent | 72b16124ed7fd7977c984d6a2dde9b6e9f8bdc81 (diff) | |
download | gnunet-efad40e99f1d00b41814d9a5ee856a88e1be979e.tar.gz gnunet-efad40e99f1d00b41814d9a5ee856a88e1be979e.zip |
-HELLO: fix memory leaks in tests.
This allows us to use sanitizers to find bugs that matter.
Signed-off-by: Martin Schanzenbach <schanzen@gnunet.org>
-rw-r--r-- | src/hello/test_hello-ng.c | 8 | ||||
-rw-r--r-- | src/hello/test_hello-uri.c | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/hello/test_hello-ng.c b/src/hello/test_hello-ng.c index 4ace9439f..ef84e2425 100644 --- a/src/hello/test_hello-ng.c +++ b/src/hello/test_hello-ng.c | |||
@@ -31,6 +31,7 @@ main (int argc, | |||
31 | struct GNUNET_PeerIdentity pid; | 31 | struct GNUNET_PeerIdentity pid; |
32 | struct GNUNET_TIME_Absolute t = GNUNET_TIME_absolute_get (); | 32 | struct GNUNET_TIME_Absolute t = GNUNET_TIME_absolute_get (); |
33 | char *res; | 33 | char *res; |
34 | char *address; | ||
34 | size_t res_len; | 35 | size_t res_len; |
35 | enum GNUNET_NetworkType nt; | 36 | enum GNUNET_NetworkType nt; |
36 | 37 | ||
@@ -47,10 +48,13 @@ main (int argc, | |||
47 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 48 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
48 | "%s\n", res); | 49 | "%s\n", res); |
49 | GNUNET_assert (NULL != | 50 | GNUNET_assert (NULL != |
50 | GNUNET_HELLO_extract_address ((void**) res, | 51 | (address = |
52 | GNUNET_HELLO_extract_address ((void**) res, | ||
51 | res_len, | 53 | res_len, |
52 | &pid, | 54 | &pid, |
53 | &nt, | 55 | &nt, |
54 | &t)); | 56 | &t))); |
57 | GNUNET_free (address); | ||
58 | GNUNET_free (res); | ||
55 | return 0; | 59 | return 0; |
56 | } | 60 | } |
diff --git a/src/hello/test_hello-uri.c b/src/hello/test_hello-uri.c index 7e70d6763..01b6f2d8e 100644 --- a/src/hello/test_hello-uri.c +++ b/src/hello/test_hello-uri.c | |||
@@ -207,6 +207,7 @@ main (int argc, | |||
207 | url); | 207 | url); |
208 | GNUNET_free (url); | 208 | GNUNET_free (url); |
209 | } | 209 | } |
210 | GNUNET_HELLO_builder_free (b); | ||
210 | 211 | ||
211 | return 0; | 212 | return 0; |
212 | } | 213 | } |