summaryrefslogtreecommitdiff
path: root/src/test/test_hs_common.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-29 13:07:13 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-29 13:07:13 -0400
commit92b4996b233a6a5d034b4ecc47b9f97985bb5886 (patch)
treea0f4f32423cbad9c4a2b8ccbc24f51b1c1b2c7ee /src/test/test_hs_common.c
parentf82f8179e65c5e0021da46fd24e4bd7d8126d8f7 (diff)
parent6e9d5fc4ec40136d173be680a85a9bfb9b99fea4 (diff)
downloadtor-92b4996b233a6a5d034b4ecc47b9f97985bb5886.tar.gz
tor-92b4996b233a6a5d034b4ecc47b9f97985bb5886.zip
Merge branch 'maint-0.3.2' into maint-0.3.3
Diffstat (limited to 'src/test/test_hs_common.c')
-rw-r--r--src/test/test_hs_common.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c
index 17ba11ca7d..16803dbd16 100644
--- a/src/test/test_hs_common.c
+++ b/src/test/test_hs_common.c
@@ -284,6 +284,7 @@ helper_add_hsdir_to_networkstatus(networkstatus_t *ns,
routerinfo_t *ri = tor_malloc_zero(sizeof(routerinfo_t));
uint8_t identity[DIGEST_LEN];
tor_addr_t ipv4_addr;
+ node_t *node = NULL;
memset(identity, identity_idx, sizeof(identity));
@@ -302,7 +303,8 @@ helper_add_hsdir_to_networkstatus(networkstatus_t *ns,
memset(&ri->cache_info.signing_key_cert->signing_key,
identity_idx, ED25519_PUBKEY_LEN);
tt_assert(nodelist_set_routerinfo(ri, NULL));
- node_t *node = node_get_mutable_by_id(ri->cache_info.identity_digest);
+
+ node = node_get_mutable_by_id(ri->cache_info.identity_digest);
tt_assert(node);
node->rs = rs;
/* We need this to exist for node_has_preferred_descriptor() to return
@@ -315,6 +317,9 @@ helper_add_hsdir_to_networkstatus(networkstatus_t *ns,
smartlist_add(ns->routerstatus_list, rs);
done:
+ if (node == NULL)
+ routerstatus_free(rs);
+
routerinfo_free(ri);
}