]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix a memory leak introduced by changes to test_options.c
authorNick Mathewson <nickm@torproject.org>
Mon, 21 Oct 2019 22:28:08 +0000 (18:28 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 21 Oct 2019 22:28:08 +0000 (18:28 -0400)
Since the FirewallPorts smartlist is now initialized, we can't just
overwrite it.

src/test/test_options.c

index 6ea037d506b5789ac87818ce7b2bbfcba4b4ee0c..1f5c85b405bbe5397e18876ce81537dae28a29dd 100644 (file)
@@ -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