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

nickm at torproject.org nickm at torproject.org
Thu Apr 9 11:55:30 UTC 2020


commit 29693b83bcfef517469d3afe7a54195adf7f378f
Author: Nick Mathewson <nickm at torproject.org>
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



More information about the tor-commits mailing list