summaryrefslogtreecommitdiff
path: root/src/test/test_hs_descriptor.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-12-12 08:10:05 -0500
committerNick Mathewson <nickm@torproject.org>2016-12-12 08:10:05 -0500
commit8143c30a5c28a5a76a82b4b17313bf340e5a47d5 (patch)
treedf892e38513347d374b50da23da7d7ea88938b03 /src/test/test_hs_descriptor.c
parent936ce997bb081a76823885fc11c3f55679800f82 (diff)
downloadtor-8143c30a5c28a5a76a82b4b17313bf340e5a47d5.tar.gz
tor-8143c30a5c28a5a76a82b4b17313bf340e5a47d5.zip
helper_compare_hs_desc: coverity memleak complaints
This test helper had a memory leak on failure, which Coverity Scan doesn't like. Closes CID 1375996 and 1375997. Not in any released Tor.
Diffstat (limited to 'src/test/test_hs_descriptor.c')
-rw-r--r--src/test/test_hs_descriptor.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/test/test_hs_descriptor.c b/src/test/test_hs_descriptor.c
index 9749c3b096..3f588dfcaf 100644
--- a/src/test/test_hs_descriptor.c
+++ b/src/test/test_hs_descriptor.c
@@ -130,6 +130,7 @@ static void
helper_compare_hs_desc(const hs_descriptor_t *desc1,
const hs_descriptor_t *desc2)
{
+ char *addr1 = NULL, *addr2 = NULL;
/* Plaintext data section. */
tt_int_op(desc1->plaintext_data.version, OP_EQ,
desc2->plaintext_data.version);
@@ -204,8 +205,8 @@ helper_compare_hs_desc(const hs_descriptor_t *desc1,
case LS_IPV4:
case LS_IPV6:
{
- char *addr1 = tor_addr_to_str_dup(&ls1->u.ap.addr),
- *addr2 = tor_addr_to_str_dup(&ls2->u.ap.addr);
+ addr1 = tor_addr_to_str_dup(&ls1->u.ap.addr);
+ addr2 = tor_addr_to_str_dup(&ls2->u.ap.addr);
tt_str_op(addr1, OP_EQ, addr2);
tor_free(addr1);
tor_free(addr2);
@@ -225,7 +226,8 @@ helper_compare_hs_desc(const hs_descriptor_t *desc1,
}
done:
- ;
+ tor_free(addr1);
+ tor_free(addr2);
}
/* Test certificate encoding put in a descriptor. */