From: Alan Modra Date: Wed, 7 Jun 2023 00:11:57 +0000 (+0930) Subject: bfd/elf.c strtab memory leak X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c7e6669a5b29240b1e5f6fd2acc987fd75b71044;p=binutils-gdb.git bfd/elf.c strtab memory leak * elf.c (_bfd_elf_compute_section_file_positions): Free strtab on set_group_contents failure return path. --- diff --git a/bfd/elf.c b/bfd/elf.c index 81eb3ef71fa..af2fb04dcbe 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -4254,7 +4254,11 @@ _bfd_elf_compute_section_file_positions (bfd *abfd, { bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed); if (failed) - return false; + { + if (need_symtab) + _bfd_elf_strtab_free (strtab); + return false; + } } shstrtab_hdr = &elf_tdata (abfd)->shstrtab_hdr;