aboutsummaryrefslogtreecommitdiff
path: root/src/test/test.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-02-11 18:10:33 -0500
committerNick Mathewson <nickm@torproject.org>2014-02-11 18:10:33 -0500
commitc3720c05fa44b3790ab0dc37e2506ee482796e21 (patch)
tree53e3146e10dbb647d13c3c64fcbe6549ff372ef0 /src/test/test.c
parent10d4d3e2d58f94418ca9554aee251232bbaaab99 (diff)
downloadtor-c3720c05fa44b3790ab0dc37e2506ee482796e21.tar
tor-c3720c05fa44b3790ab0dc37e2506ee482796e21.tar.gz
Free leakable values in the unit tests.
Thanks, Coverity! (CID 1171414, 1171415, 1171416)
Diffstat (limited to 'src/test/test.c')
-rw-r--r--src/test/test.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/test/test.c b/src/test/test.c
index 522f2af64..45f7c097d 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -875,6 +875,7 @@ test_policies(void)
{
int i;
char *policy = NULL;
+ short_policy_t *parsed;
smartlist_t *chunks = smartlist_new();
smartlist_add(chunks, tor_strdup("accept "));
for (i=1; i<10000; ++i)
@@ -883,8 +884,9 @@ test_policies(void)
policy = smartlist_join_strings(chunks, "", 0, NULL);
SMARTLIST_FOREACH(chunks, char *, ch, tor_free(ch));
smartlist_free(chunks);
- tt_ptr_op(NULL, ==, parse_short_policy(policy));/* shouldn't be accepted */
- tor_free(policy); /* could leak. */
+ parsed = parse_short_policy(policy);/* shouldn't be accepted */
+ tor_free(policy);
+ tt_ptr_op(NULL, ==, parsed);
}
/* truncation ports */