PR26069, strip/objcopy memory leaks

PR 26029
	* elf.c (_bfd_elf_close_and_cleanup): Free elf_shstrtab for
	core files as well as objects.
This commit is contained in:
Alan Modra 2020-06-03 15:33:01 +09:30
parent bb7322c671
commit 0ed18fa177
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2020-06-03 Alan Modra <amodra@gmail.com>
PR 26029
* elf.c (_bfd_elf_close_and_cleanup): Free elf_shstrtab for
core files as well as objects.
2020-06-01 H.J. Lu <hongjiu.lu@intel.com>
PR ld/26067

View File

@ -9438,7 +9438,9 @@ bfd_boolean
_bfd_elf_close_and_cleanup (bfd *abfd)
{
struct elf_obj_tdata *tdata = elf_tdata (abfd);
if (bfd_get_format (abfd) == bfd_object && tdata != NULL)
if (tdata != NULL
&& (bfd_get_format (abfd) == bfd_object
|| bfd_get_format (abfd) == bfd_core))
{
if (elf_tdata (abfd)->o != NULL && elf_shstrtab (abfd) != NULL)
_bfd_elf_strtab_free (elf_shstrtab (abfd));