aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-02-07 11:58:10 +1030
committerAlan Modra <amodra@gmail.com>2024-02-07 21:28:24 +1030
commit3ef23ee92631014b6e72e63aa0d6ecc467392546 (patch)
tree6fc9dfca0d86b468c836202d3da1aee4e2ee93c4 /binutils
parentf8c50ae2703e6b67655b13b9766365ae3073fd15 (diff)
downloadgdb-3ef23ee92631014b6e72e63aa0d6ecc467392546.zip
gdb-3ef23ee92631014b6e72e63aa0d6ecc467392546.tar.gz
gdb-3ef23ee92631014b6e72e63aa0d6ecc467392546.tar.bz2
memory leak in objdump disassemble_section
* objdump.c (disassemble_section): Free rel_ppstart on error path.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/objdump.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 49e944b..7beb221 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -3795,6 +3795,7 @@ disassemble_section (bfd *abfd, asection *section, void *inf)
{
non_fatal (_("Reading section %s failed because: %s"),
section->name, bfd_errmsg (bfd_get_error ()));
+ free (rel_ppstart);
return;
}
@@ -4075,9 +4076,7 @@ disassemble_section (bfd *abfd, asection *section, void *inf)
}
free (data);
-
- if (rel_ppstart != NULL)
- free (rel_ppstart);
+ free (rel_ppstart);
}
/* Disassemble the contents of an object file. */