From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: Tidy memory on addr2line failures
Date: Thu, 30 Mar 2023 15:18:57 +1030 [thread overview]
Message-ID: <ZCUUuatLLu5VmpJx@squeak.grove.modra.org> (raw)
* addr2line.c (process_file): Close bfd on error paths.
diff --git a/binutils/addr2line.c b/binutils/addr2line.c
index afe116a235c..b07302ddc99 100644
--- a/binutils/addr2line.c
+++ b/binutils/addr2line.c
@@ -451,6 +451,7 @@ process_file (const char *file_name, const char *section_name,
if (bfd_check_format (abfd, bfd_archive))
{
non_fatal (_("%s: cannot get addresses from archive"), file_name);
+ bfd_close (abfd);
return 1;
}
@@ -459,6 +460,7 @@ process_file (const char *file_name, const char *section_name,
bfd_nonfatal (bfd_get_filename (abfd));
if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
list_matching_formats (matching);
+ bfd_close (abfd);
return 1;
}
@@ -468,6 +470,7 @@ process_file (const char *file_name, const char *section_name,
if (section == NULL)
{
non_fatal (_("%s: cannot find section %s"), file_name, section_name);
+ bfd_close (abfd);
return 1;
}
}
--
Alan Modra
Australia Development Lab, IBM
reply other threads:[~2023-03-30 4:49 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=ZCUUuatLLu5VmpJx@squeak.grove.modra.org \
--to=amodra@gmail.com \
--cc=binutils@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).