diff options
author | Tommi Rantala <tt.rantala@gmail.com> | 2012-09-17 13:27:30 +0300 |
---|---|---|
committer | Tommi Rantala <tt.rantala@gmail.com> | 2012-09-28 14:50:02 +0300 |
commit | 0d7738ed4f7dae1b6b77d1a4dd25c5ea765de81f (patch) | |
tree | 03e17486e5efaba6ca74e7b31f722e05c337875e /tests | |
parent | 438d9de675771faaceaec362fbf4cf37eb06e295 (diff) | |
download | libunwind-0d7738ed4f7dae1b6b77d1a4dd25c5ea765de81f.tar.gz |
Cleanup dynamically allocated memory before exit in tests
Cleanup dynamically allocated memory before exit in tests in a few
places where missing. While such cleanups right before exit do not
usually make much sense (as the operating system would cleanup anyway,
so manual cleanups only burn CPU cycles), we will want to catch any
potential problems in libunwind related to the cleanups. This also stops
valgrind complaining about unreleased memory.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Gtest-bt.c | 6 | ||||
-rw-r--r-- | tests/Gtest-trace.c | 6 | ||||
-rw-r--r-- | tests/test-coredump-unwind.c | 1 | ||||
-rw-r--r-- | tests/test-proc-info.c | 2 | ||||
-rw-r--r-- | tests/test-ptrace.c | 1 |
5 files changed, 16 insertions, 0 deletions
diff --git a/tests/Gtest-bt.c b/tests/Gtest-bt.c index 1bc3f4d6..4a07c6f1 100644 --- a/tests/Gtest-bt.c +++ b/tests/Gtest-bt.c @@ -252,5 +252,11 @@ main (int argc, char **argv __attribute__((unused))) } if (verbose) printf ("SUCCESS.\n"); + + signal (SIGTERM, SIG_DFL); + stk.ss_flags = SS_DISABLE; + sigaltstack (&stk, NULL); + free (stk.ss_sp); + return 0; } diff --git a/tests/Gtest-trace.c b/tests/Gtest-trace.c index 9d43ce21..e8dd9894 100644 --- a/tests/Gtest-trace.c +++ b/tests/Gtest-trace.c @@ -267,5 +267,11 @@ main (int argc, char **argv __attribute__((unused))) if (verbose) printf ("SUCCESS.\n"); + + signal (SIGTERM, SIG_DFL); + stk.ss_flags = SS_DISABLE; + sigaltstack (&stk, NULL); + free (stk.ss_sp); + return 0; } diff --git a/tests/test-coredump-unwind.c b/tests/test-coredump-unwind.c index fc784d45..d7c7954b 100644 --- a/tests/test-coredump-unwind.c +++ b/tests/test-coredump-unwind.c @@ -389,6 +389,7 @@ main(int argc __attribute__((unused)), char **argv) } _UCD_destroy(ui); + unw_destroy_addr_space(as); return 0; } diff --git a/tests/test-proc-info.c b/tests/test-proc-info.c index 3c8fdeaf..e97ef2bb 100644 --- a/tests/test-proc-info.c +++ b/tests/test-proc-info.c @@ -162,6 +162,8 @@ main (int argc, char **argv) panic ("Second call to unw_step() returned %d instead of %d\n", ret, -UNW_ESTOPUNWIND); + unw_destroy_addr_space (as); + if (verbose) printf ("SUCCESS\n"); return 0; diff --git a/tests/test-ptrace.c b/tests/test-ptrace.c index 4708293e..69e18080 100644 --- a/tests/test-ptrace.c +++ b/tests/test-ptrace.c @@ -341,6 +341,7 @@ main (int argc, char **argv) } _UPT_destroy (ui); + unw_destroy_addr_space (as); if (nerrors) { |