[tor-commits] [tor/master] There sure are a lot of these in test_hs.c. CID 1301385

nickm at torproject.org nickm at torproject.org
Thu May 28 17:17:38 UTC 2015


commit 97a2dbb3e33c3444390e345c248663a928f8df09
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu May 28 13:17:24 2015 -0400

    There sure are a lot of these in test_hs.c. CID 1301385
---
 src/test/test_hs.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/test/test_hs.c b/src/test/test_hs.c
index 6008518..fc265bc 100644
--- a/src/test/test_hs.c
+++ b/src/test/test_hs.c
@@ -304,7 +304,7 @@ static void
 test_hs_rend_data(void *arg)
 {
   int rep;
-  rend_data_t *client = NULL;
+  rend_data_t *client = NULL, *client_dup = NULL;
   /* Binary format of a descriptor ID. */
   char desc_id[DIGEST_LEN];
   char client_cookie[REND_DESC_COOKIE_LEN];
@@ -340,7 +340,7 @@ test_hs_rend_data(void *arg)
   tt_int_op(tor_digest_is_zero(client->rend_cookie), ==, 1);
 
   /* Test dup(). */
-  rend_data_t *client_dup = rend_data_dup(client);
+  client_dup = rend_data_dup(client);
   tt_assert(client_dup);
   tt_int_op(client_dup->auth_type, ==, client->auth_type);
   tt_str_op(client_dup->onion_address, OP_EQ, client->onion_address);
@@ -359,7 +359,9 @@ test_hs_rend_data(void *arg)
   tt_int_op(tor_digest_is_zero(client_dup->rend_pk_digest), ==, 1);
   tt_int_op(tor_digest_is_zero(client_dup->rend_cookie), ==, 1);
   rend_data_free(client);
+  client = NULL;
   rend_data_free(client_dup);
+  client_dup = NULL;
 
   /* Reset state. */
   base32_decode(desc_id, sizeof(desc_id), STR_DESC_ID_BASE32,
@@ -431,6 +433,7 @@ test_hs_rend_data(void *arg)
   rend_data_free(service);
   rend_data_free(service_dup);
   rend_data_free(client);
+  rend_data_free(client_dup);
 }
 
 struct testcase_t hs_tests[] = {



More information about the tor-commits mailing list