]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix some 'dereference-before-null-check' warnings in test_circuitlist.c
authorNick Mathewson <nickm@torproject.org>
Wed, 3 Sep 2014 14:58:11 +0000 (10:58 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 3 Sep 2014 14:59:10 +0000 (10:59 -0400)
Found by Coverity Scan.

[CID 123470412347051234706]

src/test/test_circuitlist.c

index 97c6b98ac3dad6fe1a3c19c4c93c291e86700c61..53dcab33022bfabdfa834d837e0b25db721616b8 100644 (file)
@@ -79,6 +79,10 @@ test_clist_maps(void *arg)
   memset(&cam, 0, sizeof(cam));
   memset(&cdm, 0, sizeof(cdm));
 
+  tt_assert(ch1);
+  tt_assert(ch2);
+  tt_assert(ch3);
+
   ch1->cmux = tor_malloc(1);
   ch2->cmux = tor_malloc(1);
   ch3->cmux = tor_malloc(1);
@@ -161,7 +165,7 @@ test_clist_maps(void *arg)
   if (ch2)
     tor_free(ch2->cmux);
   if (ch3)
-  tor_free(ch3->cmux);
+    tor_free(ch3->cmux);
   tor_free(ch1);
   tor_free(ch2);
   tor_free(ch3);