aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_hs_cache.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-04-14 11:31:50 -0400
committerNick Mathewson <nickm@torproject.org>2019-04-14 11:31:50 -0400
commit88dc7bc171ea8bb4696aac5b142d5b39b632dc79 (patch)
treed3322ed0c22b99e89fc82f507160690bc8fda481 /src/test/test_hs_cache.c
parent7b386f2356c9c706e9432b19058dee8147030056 (diff)
downloadtor-88dc7bc171ea8bb4696aac5b142d5b39b632dc79.tar.gz
tor-88dc7bc171ea8bb4696aac5b142d5b39b632dc79.zip
Add an assertion to test_hs_cache.c to appease coverity.
Coverity doesn't like to see a path where we test a pointer for NULL if we have already ready dereferenced the pointer on that path. While in this case, the check is not needed, it's best not to remove checks from the unit tests IMO. Instead, I'm adding an earlier check, so that coverity, when analyzing this function, will think that we have always checked the pointer before dereferencing it. Closes ticket 30180; CID 1444641.
Diffstat (limited to 'src/test/test_hs_cache.c')
-rw-r--r--src/test/test_hs_cache.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/test/test_hs_cache.c b/src/test/test_hs_cache.c
index 48e8d3b8c4..2187c2be39 100644
--- a/src/test/test_hs_cache.c
+++ b/src/test/test_hs_cache.c
@@ -244,6 +244,7 @@ helper_fetch_desc_from_hsdir(const ed25519_public_key_t *blinded_key)
/* Simulate an HTTP GET request to the HSDir */
conn = dir_connection_new(AF_INET);
+ tt_assert(conn);
tor_addr_from_ipv4h(&conn->base_.addr, 0x7f000001);
TO_CONN(conn)->linked = 1;/* Pretend the conn is encrypted :) */
retval = directory_handle_command_get(conn, hsdir_query_str,