diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-06-29 13:07:13 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-06-29 13:07:13 -0400 |
commit | 1f389dadd02e9a234ee1d1c316cdb6dcc2b25489 (patch) | |
tree | 5418624ad0a04859728e253c35a1cc88a6f9dc81 /src | |
parent | 7a47379f252b4d277df7c289f8a9d3160b50eee0 (diff) | |
parent | d3ecb3a8d6d55575d4ab3f80fed5e2b2fdcc561a (diff) | |
download | tor-1f389dadd02e9a234ee1d1c316cdb6dcc2b25489.tar.gz tor-1f389dadd02e9a234ee1d1c316cdb6dcc2b25489.zip |
Merge branch 'maint-0.3.4'
Diffstat (limited to 'src')
-rw-r--r-- | src/or/hs_client.c | 6 | ||||
-rw-r--r-- | src/test/test_hs_common.c | 7 | ||||
-rw-r--r-- | src/test/test_hs_intropoint.c | 7 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src/or/hs_client.c b/src/or/hs_client.c index faccfae50b..8fddd51a47 100644 --- a/src/or/hs_client.c +++ b/src/or/hs_client.c @@ -375,14 +375,12 @@ pick_hsdir_v3(const ed25519_public_key_t *onion_identity_pk) int retval; char base64_blinded_pubkey[ED25519_BASE64_LEN + 1]; uint64_t current_time_period = hs_get_time_period_num(0); - smartlist_t *responsible_hsdirs; + smartlist_t *responsible_hsdirs = NULL; ed25519_public_key_t blinded_pubkey; routerstatus_t *hsdir_rs = NULL; tor_assert(onion_identity_pk); - responsible_hsdirs = smartlist_new(); - /* Get blinded pubkey of hidden service */ hs_build_blinded_pubkey(onion_identity_pk, NULL, 0, current_time_period, &blinded_pubkey); @@ -393,6 +391,8 @@ pick_hsdir_v3(const ed25519_public_key_t *onion_identity_pk) } /* Get responsible hsdirs of service for this time period */ + responsible_hsdirs = smartlist_new(); + hs_get_responsible_hsdirs(&blinded_pubkey, current_time_period, 0, 1, responsible_hsdirs); diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c index 6296a709dc..934b26450d 100644 --- a/src/test/test_hs_common.c +++ b/src/test/test_hs_common.c @@ -292,6 +292,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)); @@ -310,7 +311,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 @@ -323,6 +325,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); } diff --git a/src/test/test_hs_intropoint.c b/src/test/test_hs_intropoint.c index 843f39423b..2445a8fcf1 100644 --- a/src/test/test_hs_intropoint.c +++ b/src/test/test_hs_intropoint.c @@ -44,6 +44,10 @@ new_establish_intro_cell(const char *circ_nonce, trn_cell_establish_intro_t *cell = NULL; hs_service_intro_point_t *ip = NULL; + /* Ensure that *cell_out is NULL such that we can use to check if we need to + * free `cell` in case of an error. */ + *cell_out = NULL; + /* Auth key pair is generated in the constructor so we are all set for * using this IP object. */ ip = service_intro_point_new(NULL, 0); @@ -57,6 +61,9 @@ new_establish_intro_cell(const char *circ_nonce, *cell_out = cell; done: + if (*cell_out == NULL) + trn_cell_establish_intro_free(cell); + service_intro_point_free(ip); return cell_len; } |