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

[tor-commits] [tor/master] Make sure that we free 'addr' at the end of a pair of addr tests



commit 29693b83bcfef517469d3afe7a54195adf7f378f
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu Apr 9 07:54:23 2020 -0400

    Make sure that we free 'addr' at the end of a pair of addr tests
    
    Fixes a couple of Coverity warnings about possible memory leaks.
    Bug not in any released Tor.
---
 src/test/test_addr.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/test/test_addr.c b/src/test/test_addr.c
index 82d388b2a..cf5aad7e7 100644
--- a/src/test/test_addr.c
+++ b/src/test/test_addr.c
@@ -1751,10 +1751,9 @@ test_addr_is_valid(void *arg)
   get_af_unspec(test_addr);
   TEST_ADDR_VALIDITY(test_addr, 0, 0);
   TEST_ADDR_VALIDITY(test_addr, 1, 0);
-  tor_free(test_addr);
 
  done:
-  ;
+  tor_free(test_addr);
 }
 
 #define TEST_ADDR_IS_NULL(a, rv) STMT_BEGIN                 \
@@ -1797,10 +1796,9 @@ test_addr_is_null(void *arg)
   /* Test for address family AF_UNSPEC. */
   get_af_unspec(test_addr);
   TEST_ADDR_IS_NULL(test_addr, 1);
-  tor_free(test_addr);
 
  done:
-  ;
+  tor_free(test_addr);
 }
 
 #ifndef COCCI

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