[or-cvs] [tor/master] Fix a memleak

Nick Mathewson nickm at seul.org
Sun Sep 27 16:11:22 UTC 2009


Author: Sebastian Hahn <sebastian at torproject.org>
Date: Sat, 26 Sep 2009 15:58:54 +0200
Subject: Fix a memleak
Commit: a24b9e60884f6aec1bfbe8da20a02d1fdc0cd181

Found by coverity

test_mem_op_hex was leaking memory, which showed up in a few
tests.

Also, the dir_param test had a memleak of its own.

Found by Coverity
---
 src/test/test.h     |    1 +
 src/test/test_dir.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/test/test.h b/src/test/test.h
index b5076c0..18238b3 100644
--- a/src/test/test.h
+++ b/src/test/test.h
@@ -58,6 +58,7 @@
   tor_assert((length&1)==0);                                            \
   base16_decode(value2, length/2, hex, length);                         \
   test_mem_op(expr1, op, value2, length/2);                             \
+  tor_free(value2);                                                     \
   STMT_END
 
 #define test_memeq_hex(expr1, hex) test_mem_op_hex(expr1, ==, hex)
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 1ad4100..a10493e 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -504,6 +504,7 @@ test_dir_param_voting(void)
   smartlist_free(vote2.net_params);
   smartlist_free(vote3.net_params);
   smartlist_free(vote4.net_params);
+  smartlist_free(votes);
 
   return;
 }
-- 
1.5.6.5




More information about the tor-commits mailing list