aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_options.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-10-21 18:28:08 -0400
committerNick Mathewson <nickm@torproject.org>2019-10-21 18:28:08 -0400
commitbd518b9ab1815a28cbc43a03924182bbca2c4a12 (patch)
tree48b5e6c6212354bde1c106cad2bef8e15b3d6414 /src/test/test_options.c
parent5e2ffd6fd74aa27dee061199150e0625639f2240 (diff)
downloadtor-bd518b9ab1815a28cbc43a03924182bbca2c4a12.tar.gz
tor-bd518b9ab1815a28cbc43a03924182bbca2c4a12.zip
Fix a memory leak introduced by changes to test_options.c
Since the FirewallPorts smartlist is now initialized, we can't just overwrite it.
Diffstat (limited to 'src/test/test_options.c')
-rw-r--r--src/test/test_options.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/test_options.c b/src/test/test_options.c
index 6ea037d506..1f5c85b405 100644
--- a/src/test/test_options.c
+++ b/src/test/test_options.c
@@ -1553,7 +1553,9 @@ test_options_validate__reachable_addresses(void *ignored)
tdata = get_options_test_data("FascistFirewall 1\n"
"ReachableDirAddresses *:81\n"
"ReachableORAddresses *:444\n");
- tdata->opt->FirewallPorts = smartlist_new();
+ tt_assert(tdata->opt->FirewallPorts);
+ SMARTLIST_FOREACH(tdata->opt->FirewallPorts, char *, cp, tor_free(cp));
+ smartlist_clear(tdata->opt->FirewallPorts);
ret = options_validate(tdata->old_opt, tdata->opt, tdata->def_opt, 0, &msg);
tt_int_op(ret, OP_EQ, 0);
#if 0