mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-27 09:38:57 +00:00
Fix potential memory leaks in some of the binutils source files.
* rdcoff.c (parse_coff_struct_type): Free fields array upon early exit. (parse_coff_enum_type): Free names and vals arrays upon early exit. * rddbg.c (read_section_stabs_debugging_info): Free shandle and strings and stabs arrays upon early exit. * readelf.c (get_32bit_section_headers): Free shdrs structure upon early exit. (get_64bit_section_headers): Likewise. (get_32bit_elf_symbols): Generate an error if multiple symbol table index sections are associated with the same symbol section. (get_64bit_elf_symbols): Likewise. (process_dynamic_section): Generate an error if there are multiple dynamic symbol table sections, multiple dynamic string tables or multiple dynamic symbol information sections.
This commit is contained in:
@@ -409,6 +409,7 @@ parse_coff_struct_type (bfd *abfd, struct coff_symbols *symbols,
|
||||
{
|
||||
non_fatal (_("bfd_coff_get_syment failed: %s"),
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
free (fields);
|
||||
return DEBUG_TYPE_NULL;
|
||||
}
|
||||
|
||||
@@ -425,6 +426,7 @@ parse_coff_struct_type (bfd *abfd, struct coff_symbols *symbols,
|
||||
{
|
||||
non_fatal (_("bfd_coff_get_auxent failed: %s"),
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
free (fields);
|
||||
return DEBUG_TYPE_NULL;
|
||||
}
|
||||
psubaux = &auxent;
|
||||
@@ -514,6 +516,8 @@ parse_coff_enum_type (bfd *abfd, struct coff_symbols *symbols,
|
||||
{
|
||||
non_fatal (_("bfd_coff_get_syment failed: %s"),
|
||||
bfd_errmsg (bfd_get_error ()));
|
||||
free (names);
|
||||
free (vals);
|
||||
return DEBUG_TYPE_NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user