summaryrefslogtreecommitdiffstats
path: root/tests/dwfl-bug-fd-leak.c
diff options
context:
space:
mode:
authorPino Toscano <[email protected]>2015-06-27 18:33:37 +0200
committerMark Wielaard <[email protected]>2015-06-27 23:25:57 +0200
commit349d1cd1a34a7f9ee6a93aa6cf839ce0c8ceea28 (patch)
treeb6bae2189085213573c936e2faac5df45f78b14e /tests/dwfl-bug-fd-leak.c
parentaf29f77436f827d10ec9004120426cffd3401137 (diff)
tests: dwfl-bug-fd-leak: Guard against null module addresses
Do not crash if there is no module for the given address. Signed-off-by: Pino Toscano <[email protected]>
Diffstat (limited to 'tests/dwfl-bug-fd-leak.c')
-rw-r--r--tests/dwfl-bug-fd-leak.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/dwfl-bug-fd-leak.c b/tests/dwfl-bug-fd-leak.c
index 170a61a7..bcbfb290 100644
--- a/tests/dwfl-bug-fd-leak.c
+++ b/tests/dwfl-bug-fd-leak.c
@@ -65,7 +65,11 @@ elfutils_open (pid_t pid, Dwarf_Addr address)
}
else
{
- Elf *elf = dwfl_module_getelf (dwfl_addrmodule (dwfl, address), &bias);
+ Dwfl_Module *module = dwfl_addrmodule (dwfl, address);
+ if (module == NULL)
+ error (2, 0, "dwfl_addrmodule: no module available for 0x%" PRIx64 "",
+ address);
+ Elf *elf = dwfl_module_getelf (module, &bias);
if (elf == NULL)
error (2, 0, "dwfl_module_getelf: %s", dwfl_errmsg (-1));
}