]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix uninitialized-ram free in unit tests
authorNick Mathewson <nickm@torproject.org>
Thu, 17 Apr 2014 05:03:10 +0000 (01:03 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 17 Apr 2014 05:03:10 +0000 (01:03 -0400)
Fix on fb595922; bug not in any released Tor. Found with
--enable-expensive-hardening.

src/test/test_circuitlist.c

index 53cd41591f625f38d7b86e317fb7adcf3ff16bdd..ad8d0ac3af3098adf44e0e002a9b771d388f48ea 100644 (file)
@@ -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[] = {