aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-12-05 16:31:38 +1030
committerAlan Modra <amodra@gmail.com>2023-12-05 18:20:51 +1030
commit1024d59cb2478887bb778d68d49ccf95fc7d5a26 (patch)
tree1b7653e3f0142cf17ec26f25a9b87c8a4a111ea0 /binutils
parent4cd766148361c2754c88e725779912f28651c559 (diff)
downloadgdb-1024d59cb2478887bb778d68d49ccf95fc7d5a26.zip
gdb-1024d59cb2478887bb778d68d49ccf95fc7d5a26.tar.gz
gdb-1024d59cb2478887bb778d68d49ccf95fc7d5a26.tar.bz2
memory leak in display_debug_addr
* dwarf.c (display_debug_addr): Free dummy debug_addr_info entry. Don't return without freeing debug_addr_info on error paths.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/dwarf.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 47eadfd..1504690 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -7864,9 +7864,9 @@ display_debug_addr (struct dwarf_section *section,
if (header_size != 8 && header_size != 16)
{
- warn (_("Corrupt %s section: expecting header size of 8 or 16, but found %zd instead\n"),
+ warn (_("Corrupt %s section: expecting header size of 8 or 16, but found %zd instead"),
section->name, header_size);
- return 0;
+ break;
}
SAFE_BYTE_GET_AND_INC (length, curr_header, 4, entry);
@@ -7876,8 +7876,8 @@ display_debug_addr (struct dwarf_section *section,
|| length < (size_t) (entry - curr_header))
{
warn (_("Corrupt %s section: unit_length field of %#" PRIx64
- " is invalid\n"), section->name, length);
- return 0;
+ " is invalid"), section->name, length);
+ break;
}
end = curr_header + length;
SAFE_BYTE_GET_AND_INC (version, curr_header, 2, entry);
@@ -7899,7 +7899,7 @@ display_debug_addr (struct dwarf_section *section,
{
warn (_("Corrupt %s section: address size (%x) is wrong"),
section->name, address_size);
- return 0;
+ break;
}
while ((size_t) (end - entry) >= address_size)
@@ -7914,8 +7914,9 @@ display_debug_addr (struct dwarf_section *section,
}
printf ("\n");
+ free (debug_addr_info[count]);
free (debug_addr_info);
- return 1;
+ return i == count;
}
/* Display the .debug_str_offsets and .debug_str_offsets.dwo sections. */