[tor-commits] [tor/master] fix a unit tests memory leak (my fault)

nickm at torproject.org nickm at torproject.org
Tue Feb 3 20:58:52 UTC 2015


commit ac8f235446ad1b26d9f85df10cca8ce250588b83
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Feb 3 15:58:48 2015 -0500

    fix a unit tests memory leak (my fault)
---
 src/test/test_dir.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 84e80ea..849bbdb 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -2994,7 +2994,6 @@ test_dir_packages(void *arg)
   BAD("sha512= sha256="
       "3c179f46ca77069a6a0bac70212a9b3b838b2f66129cb52d568837fc79d8fcc7");
 
-  votes = smartlist_new();
   smartlist_add(votes, tor_malloc_zero(sizeof(networkstatus_t)));
   smartlist_add(votes, tor_malloc_zero(sizeof(networkstatus_t)));
   smartlist_add(votes, tor_malloc_zero(sizeof(networkstatus_t)));
@@ -3097,6 +3096,7 @@ test_dir_packages(void *arg)
  done:
   SMARTLIST_FOREACH(votes, networkstatus_t *, ns,
                     { smartlist_free(ns->package_lines); tor_free(ns); });
+  smartlist_free(votes);
   tor_free(res);
 }
 



More information about the tor-commits mailing list