[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] [PATCH 26/57] Cleanup dynamically allocated memory bef
From: |
Tommi Rantala |
Subject: |
[Libunwind-devel] [PATCH 26/57] Cleanup dynamically allocated memory before exit in tests |
Date: |
Fri, 21 Sep 2012 14:11:27 +0300 |
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.
---
tests/Gtest-bt.c | 6 ++++++
tests/Gtest-trace.c | 6 ++++++
tests/test-coredump-unwind.c | 1 +
tests/test-proc-info.c | 2 ++
tests/test-ptrace.c | 1 +
5 files changed, 16 insertions(+)
diff --git a/tests/Gtest-bt.c b/tests/Gtest-bt.c
index 1bc3f4d..4a07c6f 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 9d43ce2..e8dd989 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 fc784d4..d7c7954 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 3c8fdea..e97ef2b 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 17a1b61..aecb06e 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)
{
--
1.7.9.5
- [Libunwind-devel] [PATCH 10/57] Apply UNW_ALIGN more in src/mi/mempool.c, (continued)
- [Libunwind-devel] [PATCH 10/57] Apply UNW_ALIGN more in src/mi/mempool.c, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 13/57] PPC: remove unused `PAGE_START' macro from Ginit.c, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 09/57] Invert tdep_init() flag logic, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 14/57] HPPA: properly check dwarf_get() return value in unw_step(), Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 17/57] Clear out `ip' to avoid -Wuninitialized warning in tests/test-coredump-unwind.c, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 20/57] Annotate potentially unused variable in tests/Gtest-bt.c, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 12/57] Remove unused src/x86_64/Lis_signal_frame.c, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 16/57] Default to non-verbose mode in Ltest-cxx-exceptions, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 11/57] IA64: avoid -Wunused-but-set-variable in src/ia64/init.h, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 18/57] Avoid -Wunused-value warning in tests/Gia64-test-stack.c, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 26/57] Cleanup dynamically allocated memory before exit in tests,
Tommi Rantala <=
- [Libunwind-devel] [PATCH 19/57] Workaround volatileness warning in tests/ia64-test-setjmp.c, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 21/57] Annotate potentially unused variable in tests/Gtest-trace.c, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 22/57] Annotate potentially unused variable in tests/test-coredump-unwind.c, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 24/57] Rename `test-varargs' to `Ltest-varargs', Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 29/57] Roll `test-nocalloc' into `Ltest-nocalloc.c', Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 27/57] Rename `rs-race' to `Lrs-race', Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 28/57] Call `unw_backtrace()' explicitly in test-flush-cache.c, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 25/57] Remove unneeded `config.h' inclusion in Gtest-nomalloc, Tommi Rantala, 2012/09/21
- [Libunwind-devel] [PATCH 23/57] Drop `optimize' attribute in tests/test-varargs.c, Tommi Rantala, 2012/09/21