summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-02-16 12:55:41 -0500
committerNick Mathewson <nickm@torproject.org>2016-02-16 12:55:41 -0500
commit31c96a36994470cd63c5a71cdbd0e3acea987228 (patch)
tree1875bb956310905af7e9338fb533f1f1da886bd9 /src
parent5cd6c577df3b3f59a8380b03e45d437aa593d326 (diff)
downloadtor-31c96a36994470cd63c5a71cdbd0e3acea987228.tar.gz
tor-31c96a36994470cd63c5a71cdbd0e3acea987228.zip
Fix a NULL dereference on unit test failure. CID 1353177.
Diffstat (limited to 'src')
-rw-r--r--src/test/test_routerlist.c6
1 files changed, 4 insertions, 2 deletions
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);
}