From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: david korczynski <david@adalogics.com>, Mark Wielaard <mark@klomp.org>
Subject: [PATCH] libdwfl: Close ar members when they cannot be processed.
Date: Fri, 18 Mar 2022 16:08:25 +0100 [thread overview]
Message-ID: <20220318150825.4811-1-mark@klomp.org> (raw)
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>
---
libdwfl/ChangeLog | 5 +++++
libdwfl/offline.c | 8 ++++++--
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 @@
+2022-02-18 Mark Wielaard <mark@klomp.org>
+
+ * offline.c (process_archive_member): Close member if process_file
+ failed.
+
2022-01-03 Mark Wielaard <mark@klomp.org>
* 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 @@
/* Recover relocatibility for addresses computed from debug information.
Copyright (C) 2005-2009, 2012 Red Hat, Inc.
+ Copyright (C) 2022 Mark J. Wielaard <mark@klomp.org>
This file is part of elfutils.
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,
free (member_name);
free (module_name);
- if (*mod == NULL) /* process_file called elf_end. */
- return ELF_C_NULL;
+ if (*mod == NULL)
+ {
+ elf_end (member);
+ return ELF_C_NULL;
+ }
/* Advance the archive-reading offset for the next iteration. */
return elf_next (member);
--
2.18.4
reply other threads:[~2022-03-18 15:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220318150825.4811-1-mark@klomp.org \
--to=mark@klomp.org \
--cc=david@adalogics.com \
--cc=elfutils-devel@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).