From: Nick Mathewson Date: Tue, 16 Feb 2016 17:55:41 +0000 (-0500) Subject: Fix a NULL dereference on unit test failure. CID 1353177. X-Git-Tag: tor-0.2.8.2-alpha~118 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31c96a36994470cd63c5a71cdbd0e3acea987228;p=thirdparty%2Ftor.git Fix a NULL dereference on unit test failure. CID 1353177. --- diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c index fdbd5abf3b..eaf8a55ac0 100644 --- a/src/test/test_routerlist.c +++ b/src/test/test_routerlist.c @@ -434,8 +434,10 @@ test_routerlist_router_is_already_dir_fetching(void *arg) done: /* If a connection is never set up, connection_free chokes on it. */ - buf_free(mocked_connection->inbuf); - buf_free(mocked_connection->outbuf); + if (mocked_connection) { + buf_free(mocked_connection->inbuf); + buf_free(mocked_connection->outbuf); + } tor_free(mocked_connection); UNMOCK(connection_get_by_type_addr_port_purpose); }