diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-09-03 09:51:14 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-09-03 09:51:14 -0400 |
commit | 0e66edb25437385c50d4054727995d9f6b6be50d (patch) | |
tree | 629fb411935bb34be1eab874658a30714e727946 /src/test/test_routerset.c | |
parent | d19cbf3ab17a5afcbe0e94a16686e9ff9129dbfc (diff) | |
download | tor-0e66edb25437385c50d4054727995d9f6b6be50d.tar.gz tor-0e66edb25437385c50d4054727995d9f6b6be50d.zip |
Fix the leaks that valgrind found in the new routerset tests.
(We have a tests-shouldn't-leak policy so that we won't accidentally
ignore true-positives.)
Diffstat (limited to 'src/test/test_routerset.c')
-rw-r--r-- | src/test/test_routerset.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/test/test_routerset.c b/src/test/test_routerset.c index 0ef2c538b9..0ea1ef2d89 100644 --- a/src/test/test_routerset.c +++ b/src/test/test_routerset.c @@ -1487,8 +1487,9 @@ NS(test_main)(void *arg) /* Just recreate list, so we can simply use routerset_free. */ set->list = smartlist_new(); - done: - routerset_free(set); + done: + routerset_free(set); + smartlist_free(out); } #undef NS_SUBMODULE @@ -1810,8 +1811,8 @@ NS(test_main)(void *arg) static void NS(test_main)(void *arg) { - const routerset_t *set; - char *s; + routerset_t *set = NULL; + char *s = NULL; (void)arg; set = NULL; @@ -1823,12 +1824,14 @@ NS(test_main)(void *arg) s = routerset_to_string(set); tt_str_op(s, ==, ""); tor_free(s); + routerset_free(set); set = NULL; set = routerset_new(); smartlist_add(set->list, tor_strndup("a", 1)); s = routerset_to_string(set); tt_str_op(s, ==, "a"); tor_free(s); + routerset_free(set); set = NULL; set = routerset_new(); smartlist_add(set->list, tor_strndup("a", 1)); @@ -1836,12 +1839,11 @@ NS(test_main)(void *arg) s = routerset_to_string(set); tt_str_op(s, ==, "a,b"); tor_free(s); + routerset_free(set); set = NULL; - done: - if (s) - tor_free(s); - if (set) - routerset_free((routerset_t *)set); + done: + tor_free(s); + routerset_free((routerset_t *)set); } #undef NS_SUBMODULE @@ -2036,24 +2038,22 @@ NS(test_main)(void *arg) void NS(smartlist_free)(smartlist_t *s) { - (void)s; CALLED(smartlist_free)++; + smartlist_free__real(s); } void NS(strmap_free)(strmap_t *map, void (*free_val)(void*)) { - (void)map; - (void)free_val; CALLED(strmap_free)++; + strmap_free__real(map, free_val); } void NS(digestmap_free)(digestmap_t *map, void (*free_val)(void*)) { - (void)map; - (void)free_val; CALLED(digestmap_free)++; + digestmap_free__real(map, free_val); } #undef NS_SUBMODULE |