public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Tidy memory on addr2line failures
@ 2023-03-30  4:57 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-03-30  4:57 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a2276a6d67195b27b91edf14081303616b2bb76e

commit a2276a6d67195b27b91edf14081303616b2bb76e
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Mar 29 22:03:35 2023 +1030

    Tidy memory on addr2line failures
    
            * addr2line.c (process_file): Close bfd on error paths.

Diff:
---
 binutils/addr2line.c | 3 +++
 1 file changed, 3 insertions(+)

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;
 	}
     }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-30  4:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-30  4:57 [binutils-gdb] Tidy memory on addr2line failures Alan Modra

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).