[tor-commits] [tor/master] Fix a NULL dereference on unit test failure. CID 1353177.

nickm at torproject.org nickm at torproject.org
Tue Feb 16 17:58:56 UTC 2016


commit 31c96a36994470cd63c5a71cdbd0e3acea987228
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Feb 16 12:55:41 2016 -0500

    Fix a NULL dereference on unit test failure. CID 1353177.
---
 src/test/test_routerlist.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c
index fdbd5ab..eaf8a55 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);
 }





More information about the tor-commits mailing list