]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Avoid dereferencing null on unit test failure for link handshakes.
authorNick Mathewson <nickm@torproject.org>
Thu, 28 May 2015 16:41:00 +0000 (12:41 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 28 May 2015 16:41:00 +0000 (12:41 -0400)
This fixes CID 1301368 -- found by coverity

src/test/test_link_handshake.c

index bfdd6f3d1ae187f4f482306caedca488c48f7dab..b3b65319aa672c62326f199c6d8904e24f50db8b 100644 (file)
@@ -179,9 +179,11 @@ test_link_handshake_certs_ok(void *arg)
   tor_free(cell2);
   certs_cell_free(cc1);
   certs_cell_free(cc2);
-  circuitmux_free(chan1->base_.cmux);
+  if (chan1)
+    circuitmux_free(chan1->base_.cmux);
   tor_free(chan1);
-  circuitmux_free(chan2->base_.cmux);
+  if (chan2)
+    circuitmux_free(chan2->base_.cmux);
   tor_free(chan2);
   crypto_pk_free(key1);
   crypto_pk_free(key2);