[tor-commits] [tor/master] Avoid dereferencing null on unit test failure for link handshakes.

nickm at torproject.org nickm at torproject.org
Thu May 28 16:41:33 UTC 2015


commit a348df6d8b049785ffaec4a56adda744a63a9581
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu May 28 12:41:00 2015 -0400

    Avoid dereferencing null on unit test failure for link handshakes.
    
    This fixes CID 1301368 -- found by coverity
---
 src/test/test_link_handshake.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/test/test_link_handshake.c b/src/test/test_link_handshake.c
index bfdd6f3..b3b6531 100644
--- a/src/test/test_link_handshake.c
+++ b/src/test/test_link_handshake.c
@@ -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);



More information about the tor-commits mailing list