mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
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.)
This commit is contained in:
parent
d19cbf3ab1
commit
0e66edb254
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user