mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-25 00:27:39 +01:00
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.
This commit is contained in:
parent
438d9de675
commit
0d7738ed4f
5 changed files with 16 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -389,6 +389,7 @@ main(int argc __attribute__((unused)), char **argv)
|
|||
}
|
||||
|
||||
_UCD_destroy(ui);
|
||||
unw_destroy_addr_space(as);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -341,6 +341,7 @@ main (int argc, char **argv)
|
|||
}
|
||||
|
||||
_UPT_destroy (ui);
|
||||
unw_destroy_addr_space (as);
|
||||
|
||||
if (nerrors)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue