[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/maint-0.3.2] Fix some memory errors in the recent coverity fixes.



commit d583459d5845378a2b9ac0174ebe67a7473932fb
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Fri Jun 29 13:48:36 2018 -0400

    Fix some memory errors in the recent coverity fixes.
    
    Found by asan on travis :/
---
 src/test/test_channelpadding.c | 1 +
 src/test/test_hs_descriptor.c  | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/src/test/test_channelpadding.c b/src/test/test_channelpadding.c
index 0bc9699fe..d399738ce 100644
--- a/src/test/test_channelpadding.c
+++ b/src/test/test_channelpadding.c
@@ -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);
diff --git a/src/test/test_hs_descriptor.c b/src/test/test_hs_descriptor.c
index 45850ada4..a40616c61 100644
--- a/src/test/test_hs_descriptor.c
+++ b/src/test/test_hs_descriptor.c
@@ -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);
   }
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits