diff options
author | Andreas Nordal <andreas_nordal_4@hotmail.com> | 2016-03-18 23:14:16 +0100 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2016-03-27 17:40:48 -0700 |
commit | 6495bd470d40b2b489e6fe350e2da08be64d4bec (patch) | |
tree | 79d8821e2016cdf863ffa247ee0a3a24886add1a /src/fish_tests.cpp | |
parent | 7accadc33f817a3e17c14c989a3b83f0d6737665 (diff) |
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.
Diffstat (limited to 'src/fish_tests.cpp')
-rw-r--r-- | src/fish_tests.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp index dfc34609..5bacab80 100644 --- a/src/fish_tests.cpp +++ b/src/fish_tests.cpp @@ -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(); |