summaryrefslogtreecommitdiffstats
path: root/libdwfl
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2022-03-18 16:01:20 +0100
committerMark Wielaard <mark@klomp.org>2022-03-18 16:01:20 +0100
commit0e142c560bf599627056efd6deb41af36a7163dd (patch)
treec664cab3b64f03752258bd15721e1db680e214de /libdwfl
parentlibelf: Check alignment of Verdef, Verdaux, Verneed and Vernaux offsets (diff)
downloadelfutils-0e142c560bf599627056efd6deb41af36a7163dd.tar.gz
elfutils-0e142c560bf599627056efd6deb41af36a7163dd.tar.bz2
elfutils-0e142c560bf599627056efd6deb41af36a7163dd.tar.xz
libdwfl: Close ar members when they cannot be processed.
When reporting ar members they should be closed when they cannot be processed. A comment in offline.c said that process_file called elf_end if it returned NULL. But this is incorrect. And other places that call process_file do call elf_end explicitly when it returns NULL. Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'libdwfl')
-rw-r--r--libdwfl/ChangeLog5
-rw-r--r--libdwfl/offline.c8
2 files changed, 11 insertions, 2 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index b2588b12..182f4e34 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
12022-02-18 Mark Wielaard <mark@klomp.org>
2
3 * offline.c (process_archive_member): Close member if process_file
4 failed.
5
12022-01-03 Mark Wielaard <mark@klomp.org> 62022-01-03 Mark Wielaard <mark@klomp.org>
2 7
3 * link_map.c (dwfl_link_map_report): Only declare d32 and d64 before 8 * link_map.c (dwfl_link_map_report): Only declare d32 and d64 before
diff --git a/libdwfl/offline.c b/libdwfl/offline.c
index d8697cf2..58ba4c36 100644
--- a/libdwfl/offline.c
+++ b/libdwfl/offline.c
@@ -1,5 +1,6 @@
1/* Recover relocatibility for addresses computed from debug information. 1/* Recover relocatibility for addresses computed from debug information.
2 Copyright (C) 2005-2009, 2012 Red Hat, Inc. 2 Copyright (C) 2005-2009, 2012 Red Hat, Inc.
3 Copyright (C) 2022 Mark J. Wielaard <mark@klomp.org>
3 This file is part of elfutils. 4 This file is part of elfutils.
4 5
5 This file is free software; you can redistribute it and/or modify 6 This file is free software; you can redistribute it and/or modify
@@ -233,8 +234,11 @@ process_archive_member (Dwfl *dwfl, const char *name, const char *file_name,
233 free (member_name); 234 free (member_name);
234 free (module_name); 235 free (module_name);
235 236
236 if (*mod == NULL) /* process_file called elf_end. */ 237 if (*mod == NULL)
237 return ELF_C_NULL; 238 {
239 elf_end (member);
240 return ELF_C_NULL;
241 }
238 242
239 /* Advance the archive-reading offset for the next iteration. */ 243 /* Advance the archive-reading offset for the next iteration. */
240 return elf_next (member); 244 return elf_next (member);