diff --git a/src/feature/hs/hs_client.c b/src/feature/hs/hs_client.c index 6f031eb3b9..a6384b87a3 100644 --- a/src/feature/hs/hs_client.c +++ b/src/feature/hs/hs_client.c @@ -1524,10 +1524,9 @@ parse_auth_file_content(const char *client_key_str) if (seckey_b32) { memwipe(seckey_b32, 0, strlen(seckey_b32)); } - if (fields) { - SMARTLIST_FOREACH(fields, char *, s, tor_free(s)); - smartlist_free(fields); - } + tor_assert(fields); + SMARTLIST_FOREACH(fields, char *, s, tor_free(s)); + smartlist_free(fields); return auth; } diff --git a/src/feature/hs/hs_service.c b/src/feature/hs/hs_service.c index 43e5626a57..30d23eb771 100644 --- a/src/feature/hs/hs_service.c +++ b/src/feature/hs/hs_service.c @@ -1192,10 +1192,9 @@ parse_authorized_client(const char *client_key_str) if (pubkey_b32) { memwipe(pubkey_b32, 0, strlen(pubkey_b32)); } - if (fields) { - SMARTLIST_FOREACH(fields, char *, s, tor_free(s)); - smartlist_free(fields); - } + tor_assert(fields); + SMARTLIST_FOREACH(fields, char *, s, tor_free(s)); + smartlist_free(fields); return client; } diff --git a/src/test/hs_test_helpers.c b/src/test/hs_test_helpers.c index 4e13ba43a7..dcec1b9d48 100644 --- a/src/test/hs_test_helpers.c +++ b/src/test/hs_test_helpers.c @@ -241,11 +241,11 @@ hs_helper_desc_equal(const hs_descriptor_t *desc1, hs_desc_authorized_client_t *client1 = smartlist_get(desc1->superencrypted_data.clients, i), *client2 = smartlist_get(desc2->superencrypted_data.clients, i); - tor_memeq(client1->client_id, client2->client_id, + tt_mem_op(client1->client_id, OP_EQ, client2->client_id, sizeof(client1->client_id)); - tor_memeq(client1->iv, client2->iv, + tt_mem_op(client1->iv, OP_EQ, client2->iv, sizeof(client1->iv)); - tor_memeq(client1->encrypted_cookie, client2->encrypted_cookie, + tt_mem_op(client1->encrypted_cookie, OP_EQ, client2->encrypted_cookie, sizeof(client1->encrypted_cookie)); } } diff --git a/src/test/test_hs_descriptor.c b/src/test/test_hs_descriptor.c index 4889281cb1..90f2be2906 100644 --- a/src/test/test_hs_descriptor.c +++ b/src/test/test_hs_descriptor.c @@ -675,6 +675,8 @@ test_decode_bad_signature(void *arg) (void) arg; + memset(&desc_plaintext, 0, sizeof(desc_plaintext)); + /* Update approx time to dodge cert expiration */ update_approx_time(1502661599); diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c index 6a061eaea4..bceeafd149 100644 --- a/src/test/test_hs_service.c +++ b/src/test/test_hs_service.c @@ -563,9 +563,7 @@ test_load_keys_with_client_auth(void *arg) } SMARTLIST_FOREACH_END(pubkey_b32); done: - if (pubkey_b32_list) { - SMARTLIST_FOREACH(pubkey_b32_list, char *, s, tor_free(s)); - } + SMARTLIST_FOREACH(pubkey_b32_list, char *, s, tor_free(s)); smartlist_free(pubkey_b32_list); tor_free(hsdir_v3); hs_free_all();