summaryrefslogtreecommitdiff
path: root/src/test/test_hs_descriptor.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-11-04 14:21:53 -0400
committerNick Mathewson <nickm@torproject.org>2016-11-04 14:22:04 -0400
commita4291eef5aeeb9ba8939b563a657ac50d4447b7e (patch)
treed14b249aff2e879b591d0c5883e55746d7c252a2 /src/test/test_hs_descriptor.c
parent6ac85ca2b4ca669657f19afc8e622ac2dd7191d2 (diff)
downloadtor-a4291eef5aeeb9ba8939b563a657ac50d4447b7e.tar.gz
tor-a4291eef5aeeb9ba8939b563a657ac50d4447b7e.zip
Expose desc_intro_point_free to the tests, and use it.
Also fix another couple of leaks.
Diffstat (limited to 'src/test/test_hs_descriptor.c')
-rw-r--r--src/test/test_hs_descriptor.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/test/test_hs_descriptor.c b/src/test/test_hs_descriptor.c
index 01e32cfa40..846732cb68 100644
--- a/src/test/test_hs_descriptor.c
+++ b/src/test/test_hs_descriptor.c
@@ -593,7 +593,7 @@ test_decode_intro_point(void *arg)
int ret;
char *encoded_ip = NULL;
size_t len_out;
- hs_desc_intro_point_t *ip;
+ hs_desc_intro_point_t *ip = NULL;
hs_descriptor_t *desc = NULL;
(void) arg;
@@ -673,6 +673,8 @@ test_decode_intro_point(void *arg)
const char *junk = "this is not a descriptor";
ip = decode_introduction_point(desc, junk);
tt_assert(!ip);
+ desc_intro_point_free(ip);
+ ip = NULL;
}
/* Invalid link specifiers. */
@@ -689,6 +691,8 @@ test_decode_intro_point(void *arg)
tt_assert(!ip);
tor_free(encoded_ip);
smartlist_free(lines);
+ desc_intro_point_free(ip);
+ ip = NULL;
}
/* Invalid auth key type. */
@@ -803,6 +807,7 @@ test_decode_intro_point(void *arg)
done:
hs_descriptor_free(desc);
+ desc_intro_point_free(ip);
}
const char encrypted_desc_portion[] = "create2-formats 2\n"
@@ -1027,6 +1032,7 @@ test_validate_cert(void *arg)
int ret;
time_t now = time(NULL);
ed25519_keypair_t kp;
+ tor_cert_t *cert = NULL;
(void) arg;
@@ -1034,7 +1040,7 @@ test_validate_cert(void *arg)
tt_int_op(ret, ==, 0);
/* Cert of type CERT_TYPE_AUTH_HS_IP_KEY. */
- tor_cert_t *cert = tor_cert_create(&kp, CERT_TYPE_AUTH_HS_IP_KEY,
+ cert = tor_cert_create(&kp, CERT_TYPE_AUTH_HS_IP_KEY,
&kp.pubkey, now, 3600,
CERT_FLAG_INCLUDE_SIGNING_KEY);
tt_assert(cert);
@@ -1062,7 +1068,7 @@ test_validate_cert(void *arg)
tt_int_op(ret, OP_EQ, 0);
done:
- ;
+ tor_cert_free(cert);
}
static void