diff options
author | Mark Wielaard <mjw@redhat.com> | 2015-12-01 15:55:08 +0100 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2016-01-02 20:37:44 +0100 |
commit | a1372e06a04bad29e8c3c79d95497a8e381f823f (patch) | |
tree | b03cad8fba9772ba5f3524fcf40e3829b6c7c1af /tests/addrcfi.c | |
parent | db30f8b21993c09339c5bced7b0827eedf8d4fef (diff) | |
download | elfutils-a1372e06a04bad29e8c3c79d95497a8e381f823f.tar.gz |
tests: Fix some memory leaks in testcases.
Make sure all structures allocated in the testcases are disposed so
running them under valgrind will show no memory leaks.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'tests/addrcfi.c')
-rw-r--r-- | tests/addrcfi.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/addrcfi.c b/tests/addrcfi.c index eb950c0b..589b8513 100644 --- a/tests/addrcfi.c +++ b/tests/addrcfi.c @@ -160,10 +160,19 @@ handle_address (GElf_Addr pc, Dwfl *dwfl) Dwfl_Module *mod = dwfl_addrmodule (dwfl, pc); struct stuff stuff; - return (handle_cfi (dwfl, ".eh_frame", - dwfl_module_eh_cfi (mod, &stuff.bias), pc, &stuff) - & handle_cfi (dwfl, ".debug_frame", - dwfl_module_dwarf_cfi (mod, &stuff.bias), pc, &stuff)); + stuff.frame = NULL; + stuff.bias = 0; + int res = handle_cfi (dwfl, ".eh_frame", + dwfl_module_eh_cfi (mod, &stuff.bias), pc, &stuff); + free (stuff.frame); + + stuff.frame = NULL; + stuff.bias = 0; + res &= handle_cfi (dwfl, ".debug_frame", + dwfl_module_dwarf_cfi (mod, &stuff.bias), pc, &stuff); + free (stuff.frame); + + return res; } int |