aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-04-17 01:03:10 -0400
committerNick Mathewson <nickm@torproject.org>2014-04-17 01:03:10 -0400
commit0175fcaf7c6284f8961e112fab80beb4257f0faf (patch)
tree765f41d7c683d316c06fb93bd85a900d29277040
parentab83a27450fc3afb57874ca202dcee570607a1ff (diff)
downloadtor-0175fcaf7c6284f8961e112fab80beb4257f0faf.tar
tor-0175fcaf7c6284f8961e112fab80beb4257f0faf.tar.gz
Fix uninitialized-ram free in unit tests
Fix on fb595922; bug not in any released Tor. Found with --enable-expensive-hardening.
-rw-r--r--src/test/test_circuitlist.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/test/test_circuitlist.c b/src/test/test_circuitlist.c
index 53cd41591..ad8d0ac3a 100644
--- a/src/test/test_circuitlist.c
+++ b/src/test/test_circuitlist.c
@@ -247,10 +247,14 @@ test_rend_token_maps(void *arg)
tt_ptr_op(NULL, ==, circuit_get_intro_point(tok3));
done:
- circuit_free(TO_CIRCUIT(c1));
- circuit_free(TO_CIRCUIT(c2));
- circuit_free(TO_CIRCUIT(c3));
- circuit_free(TO_CIRCUIT(c4));
+ if (c1)
+ circuit_free(TO_CIRCUIT(c1));
+ if (c2)
+ circuit_free(TO_CIRCUIT(c2));
+ if (c3)
+ circuit_free(TO_CIRCUIT(c3));
+ if (c4)
+ circuit_free(TO_CIRCUIT(c4));
}
struct testcase_t circuitlist_tests[] = {