[tor-commits] [tor/master] scan-build: fix a crash-on-fail possibility in test_policy.c

nickm at torproject.org nickm at torproject.org
Fri Apr 25 05:30:23 UTC 2014


commit 69ea4450caee65be56912fd2618c2b95413a0763
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Apr 18 20:33:21 2014 -0400

    scan-build: fix a crash-on-fail possibility in test_policy.c
---
 src/test/test_policy.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/test/test_policy.c b/src/test/test_policy.c
index d2ba161..491c9a2 100644
--- a/src/test/test_policy.c
+++ b/src/test/test_policy.c
@@ -417,8 +417,10 @@ test_dump_exit_policy_to_string(void *arg)
 
  done:
 
- SMARTLIST_FOREACH(ri->exit_policy, addr_policy_t *,
-                   entry, addr_policy_free(entry));
+ if (ri->exit_policy) {
+   SMARTLIST_FOREACH(ri->exit_policy, addr_policy_t *,
+                     entry, addr_policy_free(entry));
+ }
  tor_free(ri);
  tor_free(ep);
 }





More information about the tor-commits mailing list