]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix a memleak
authorSebastian Hahn <sebastian@torproject.org>
Sat, 26 Sep 2009 13:58:54 +0000 (15:58 +0200)
committerNick Mathewson <nickm@torproject.org>
Sun, 27 Sep 2009 16:02:35 +0000 (12:02 -0400)
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
src/test/test_dir.c

index b5076c04d9a00d2bb9b9403fb7711f0274f829eb..18238b3301eb7c911fba3a3c1899d8690e4044d7 100644 (file)
@@ -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)
index 1ad41007987ef0b189c03c37fa35b7a846cf9a48..a10493e7fa5ca83b313b7926b62d2c676b82a652 100644 (file)
@@ -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;
 }