]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix a NULL dereference on unit test failure. CID 1353177.
authorNick Mathewson <nickm@torproject.org>
Tue, 16 Feb 2016 17:55:41 +0000 (12:55 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 16 Feb 2016 17:55:41 +0000 (12:55 -0500)
src/test/test_routerlist.c

index fdbd5abf3ba5be4adf13a14eaca4684c091cd76d..eaf8a55ac072e950e05140c6008ccc5b8ecd3a4d 100644 (file)
@@ -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);
 }