]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix some memory errors in the recent coverity fixes.
authorNick Mathewson <nickm@torproject.org>
Fri, 29 Jun 2018 17:48:36 +0000 (13:48 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 29 Jun 2018 17:48:36 +0000 (13:48 -0400)
Found by asan on travis :/

src/test/test_channelpadding.c
src/test/test_hs_descriptor.c

index 0bc9699feb45bee05cd1517012e376fb43d69058..d399738ce693f5b804242ed9c2ecf4a0d305606d 100644 (file)
@@ -677,6 +677,7 @@ test_channelpadding_consensus(void *arg)
   memcpy(relay->identity_digest,
           ((channel_tls_t *)chan)->conn->identity_digest, DIGEST_LEN);
   smartlist_add(current_md_consensus->routerstatus_list, relay);
+  relay = NULL; /* Prevent double-free */
 
   tried_to_write_cell = 0;
   decision = channelpadding_decide_to_pad_channel(chan);
index 45850ada4efedb9f41c8aea3467a2891fa6ff507..a40616c61e2ed8d71d5677aca2b86d38136770ed 100644 (file)
@@ -207,6 +207,7 @@ test_link_specifier(void *arg)
     tt_int_op(link_specifier_get_un_ipv4_port(ls), ==, spec.u.ap.port);
 
     link_specifier_free(ls);
+    ls = NULL;
     tor_free(b64);
   }
 
@@ -236,6 +237,7 @@ test_link_specifier(void *arg)
     tt_int_op(link_specifier_get_un_ipv6_port(ls), ==, spec.u.ap.port);
 
     link_specifier_free(ls);
+    ls = NULL;
     tor_free(b64);
   }
 
@@ -263,6 +265,7 @@ test_link_specifier(void *arg)
     tt_mem_op(spec.u.legacy_id, OP_EQ, id, DIGEST_LEN);
 
     link_specifier_free(ls);
+    ls = NULL;
     tor_free(b64);
   }