aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-02-09 22:35:40 -0800
committerNick Mathewson <nickm@torproject.org>2015-02-09 22:35:40 -0800
commitf4c0735933699d899bd31c4e938862bcec7fd64c (patch)
treeb0770db51fc3be3c4dd6906f26147b5856b0d30b
parent9667b2b88a1f8e9af08704c8bc95b8399a6e4145 (diff)
parentd0759da14eeaefb186d8d514f971b0b1a0618a0f (diff)
downloadtor-f4c0735933699d899bd31c4e938862bcec7fd64c.tar.gz
tor-f4c0735933699d899bd31c4e938862bcec7fd64c.zip
Merge remote-tracking branch 'teor/avoid-NULL-smartlist-foreach'
-rw-r--r--src/test/test_address.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/test/test_address.c b/src/test/test_address.c
index f98cc12b62..7f7347fa88 100644
--- a/src/test/test_address.c
+++ b/src/test/test_address.c
@@ -207,9 +207,10 @@ test_address_ifaddrs_to_smartlist(void *arg)
tor_free(ifa_ipv4);
tor_free(ifa_ipv6);
tor_free(sockaddr_to_check);
- SMARTLIST_FOREACH(smartlist, tor_addr_t *, t, tor_free(t));
- smartlist_free(smartlist);
-
+ if (smartlist) {
+ SMARTLIST_FOREACH(smartlist, tor_addr_t *, t, tor_free(t));
+ smartlist_free(smartlist);
+ }
return;
}
@@ -442,8 +443,10 @@ test_address_get_if_addrs_ioctl(void *arg)
tt_assert(smartlist_contains_localhost_tor_addr(result));
done:
- SMARTLIST_FOREACH(result, tor_addr_t *, t, tor_free(t));
- smartlist_free(result);
+ if (result) {
+ SMARTLIST_FOREACH(result, tor_addr_t *, t, tor_free(t));
+ smartlist_free(result);
+ }
return;
}