aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_link_handshake.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-05-28 12:41:00 -0400
committerNick Mathewson <nickm@torproject.org>2015-05-28 12:41:00 -0400
commita348df6d8b049785ffaec4a56adda744a63a9581 (patch)
treec887ea77d176c2d2a23ff8d67f840af92ccfc15c /src/test/test_link_handshake.c
parentc03694938ed0b9510d1d6b04d0e650dc64d14074 (diff)
downloadtor-a348df6d8b049785ffaec4a56adda744a63a9581.tar.gz
tor-a348df6d8b049785ffaec4a56adda744a63a9581.zip
Avoid dereferencing null on unit test failure for link handshakes.
This fixes CID 1301368 -- found by coverity
Diffstat (limited to 'src/test/test_link_handshake.c')
-rw-r--r--src/test/test_link_handshake.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/test/test_link_handshake.c b/src/test/test_link_handshake.c
index bfdd6f3d1a..b3b65319aa 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);