diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-12-15 14:00:08 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-12-15 14:00:08 -0500 |
commit | a56fb58d6e1e93b95e2a060b61f3d00eab95a298 (patch) | |
tree | bbd8ff0c79de7bcd05ce9c0ed15a41deb578635b /src/test/test_connection.c | |
parent | efc8b2dbbfa0659405edb1e388f1f84cb8023425 (diff) | |
download | tor-a56fb58d6e1e93b95e2a060b61f3d00eab95a298.tar.gz tor-a56fb58d6e1e93b95e2a060b61f3d00eab95a298.zip |
Fix some memory leaks in the unit tests
Diffstat (limited to 'src/test/test_connection.c')
-rw-r--r-- | src/test/test_connection.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/test/test_connection.c b/src/test/test_connection.c index 7e466a97e9..f6e08fdf1f 100644 --- a/src/test/test_connection.c +++ b/src/test/test_connection.c @@ -501,21 +501,26 @@ test_conn_get_rend(void *arg) ; } -#define sl_is_conn_assert(sl, conn) \ - do { \ - tt_assert(smartlist_len((sl)) == 1); \ - tt_assert(smartlist_get((sl), 0) == (conn)); \ +#define sl_is_conn_assert(sl_input, conn) \ + do { \ + the_sl = (sl_input); \ + tt_assert(smartlist_len((the_sl)) == 1); \ + tt_assert(smartlist_get((the_sl), 0) == (conn)); \ + smartlist_free(the_sl); the_sl = NULL; \ } while (0) -#define sl_no_conn_assert(sl) \ - do { \ - tt_assert(smartlist_len((sl)) == 0); \ +#define sl_no_conn_assert(sl_input) \ + do { \ + the_sl = (sl_input); \ + tt_assert(smartlist_len((the_sl)) == 0); \ + smartlist_free(the_sl); the_sl = NULL; \ } while (0) static void test_conn_get_rsrc(void *arg) { dir_connection_t *conn = DOWNCAST(dir_connection_t, arg); + smartlist_t *the_sl = NULL; tt_assert(conn); assert_connection_ok(&conn->base_, time(NULL)); @@ -630,7 +635,7 @@ test_conn_get_rsrc(void *arg) == 0); done: - ; + smartlist_free(the_sl); } static void |