Fix memory leaks at exit found in tests

This fixes all memory leaks found by compiling with
clang++ -g -fsanitize=address and running the tests.

Method:
Ensure that memory is freed by the destructor of its respective container,
either by storing objects directly instead of by pointer, or implementing
the required destructor.
This commit is contained in:
Andreas Nordal
2016-03-18 23:14:16 +01:00
committed by ridiculousfish
parent 7accadc33f
commit 6495bd470d
5 changed files with 95 additions and 84 deletions

View File

@@ -2645,9 +2645,11 @@ static void test_universal()
if (system("mkdir -p /tmp/fish_uvars_test/")) err(L"mkdir failed");
const int threads = 16;
static int ctx[threads];
for (int i=0; i < threads; i++)
{
iothread_perform(test_universal_helper, new int(i));
ctx[i] = i;
iothread_perform(test_universal_helper, &ctx[i]);
}
iothread_drain_all();