summaryrefslogtreecommitdiff
path: root/src/test/test_hs_common.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-06-28 12:24:26 -0400
committerNick Mathewson <nickm@torproject.org>2019-06-28 12:36:44 -0400
commit5fa2b322005d1860d39e420cb6d3ed25f5073389 (patch)
tree9cec0c17c2becd3cabbb3331052d81c9d4ba0e5d /src/test/test_hs_common.c
parent68792f77e51f84d0fb6758ef9491a70570ac9a53 (diff)
downloadtor-5fa2b322005d1860d39e420cb6d3ed25f5073389.tar.gz
tor-5fa2b322005d1860d39e420cb6d3ed25f5073389.zip
Coverity: fix test issues with always-present 'service' var.
Coverity is worried that we check "service" at the end of these test functions, since it doesn't see any way to reach the cleanup code without having first dereferenced the variable. Removing the check would be unwise in this case: instead we add a tt_assert check before using "service" so that coverity thinks that the check is doing something useful. Bugfix on 0.3.2.1-alpha.
Diffstat (limited to 'src/test/test_hs_common.c')
-rw-r--r--src/test/test_hs_common.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c
index abded6021e..de3f7e04f7 100644
--- a/src/test/test_hs_common.c
+++ b/src/test/test_hs_common.c
@@ -502,6 +502,7 @@ test_desc_reupload_logic(void *arg)
pubkey_hex, strlen(pubkey_hex));
hs_build_address(&pubkey, HS_VERSION_THREE, onion_addr);
service = tor_malloc_zero(sizeof(hs_service_t));
+ tt_assert(service);
memcpy(service->onion_address, onion_addr, sizeof(service->onion_address));
ed25519_secret_key_generate(&service->keys.identity_sk, 0);
ed25519_public_key_generate(&service->keys.identity_pk,