public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] objdump: sframe: fix memory leaks
@ 2022-12-09 18:28 Indu Bhagat
  0 siblings, 0 replies; only message in thread
From: Indu Bhagat @ 2022-12-09 18:28 UTC (permalink / raw)
  To: bfd-cvs

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

commit ed38cbc331efbfe65def811773e68c431bfbcc75
Author: Indu Bhagat <indu.bhagat@oracle.com>
Date:   Fri Dec 9 10:25:46 2022 -0800

    objdump: sframe: fix memory leaks
    
    ChangeLog:
    
            * binutils/objdump.c (dump_section_sframe): free up contents and
            SFrame decoder context on exit.

Diff:
---
 binutils/objdump.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/binutils/objdump.c b/binutils/objdump.c
index d95c8b68bf0..6695c5d343f 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -4871,12 +4871,18 @@ dump_section_sframe (bfd *abfd ATTRIBUTE_UNUSED,
   /* Decode the contents of the section.  */
   sfd_ctx = sframe_decode ((const char*)sframe_data, sf_size, &err);
   if (!sfd_ctx)
-    bfd_fatal (bfd_get_filename (abfd));
+    {
+      free (sframe_data);
+      bfd_fatal (bfd_get_filename (abfd));
+    }
 
   printf (_("Contents of the SFrame section %s:"),
 	  sanitize_string (sect_name));
   /* Dump the contents as text.  */
   dump_sframe (sfd_ctx, sf_vma);
+
+  free (sframe_data);
+  sframe_decoder_free (&sfd_ctx);
 }

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

only message in thread, other threads:[~2022-12-09 18:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-09 18:28 [binutils-gdb] objdump: sframe: fix memory leaks Indu Bhagat

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