diff options
author | Indu Bhagat <indu.bhagat@oracle.com> | 2022-12-09 10:25:46 -0800 |
---|---|---|
committer | Indu Bhagat <indu.bhagat@oracle.com> | 2022-12-09 10:25:46 -0800 |
commit | ed38cbc331efbfe65def811773e68c431bfbcc75 (patch) | |
tree | bd1ca2e38fdad16c34b9e4477f4d5da3e1056389 /binutils | |
parent | b659fb35854e49ac16a5538d24bf0e3f0d6e6121 (diff) | |
download | binutils-ed38cbc331efbfe65def811773e68c431bfbcc75.zip binutils-ed38cbc331efbfe65def811773e68c431bfbcc75.tar.gz binutils-ed38cbc331efbfe65def811773e68c431bfbcc75.tar.bz2 |
objdump: sframe: fix memory leaks
ChangeLog:
* binutils/objdump.c (dump_section_sframe): free up contents and
SFrame decoder context on exit.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/objdump.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c index d95c8b6..6695c5d 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); } |