[tor-commits] [tor/maint-0.3.1] Fix an unreachable memory leak in the unit tests

nickm at torproject.org nickm at torproject.org
Fri Jul 28 13:54:44 UTC 2017


commit eb677c5870ad67e0aa883d700f630c7a9ee99af3
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Jul 28 09:52:34 2017 -0400

    Fix an unreachable memory leak in the unit tests
    
    This is CID 1415726.
---
 src/test/test_hs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/test/test_hs.c b/src/test/test_hs.c
index b4817a21e..5aae6c5b9 100644
--- a/src/test/test_hs.c
+++ b/src/test/test_hs.c
@@ -572,6 +572,7 @@ test_single_onion_poisoning(void *arg)
   char *dir2 = tor_strdup(get_fname_rnd("test_hs_dir2"));
   smartlist_t *services = smartlist_new();
   char *poison_path = NULL;
+  char *err_msg = NULL;
 
   /* No services, no service to verify, no problem! */
   mock_options->HiddenServiceSingleHopMode = 0;
@@ -607,7 +608,6 @@ test_single_onion_poisoning(void *arg)
   /* Add port to service 1 */
   service_1->ports = smartlist_new();
   service_2->ports = smartlist_new();
-  char *err_msg = NULL;
   rend_service_port_config_t *port1 = rend_service_parse_port_config("80", " ",
                                                                      &err_msg);
   tt_assert(port1);
@@ -806,6 +806,7 @@ test_single_onion_poisoning(void *arg)
   rend_service_free(service_2);
   UNMOCK(get_options);
   tor_free(mock_options->DataDirectory);
+  tor_free(err_msg);
 }
 
 static rend_service_t *



More information about the tor-commits mailing list