bfd/elf.c strtab memory leak
authorAlan Modra <amodra@gmail.com>
Wed, 7 Jun 2023 00:11:57 +0000 (09:41 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 7 Jun 2023 01:35:11 +0000 (11:05 +0930)
* elf.c (_bfd_elf_compute_section_file_positions): Free strtab
on set_group_contents failure return path.

bfd/elf.c

index 81eb3ef71fa952cbd387bf7b26aea76166aaf795..af2fb04dcbed96a3f03deb97b62f7a5bda305e0c 100644 (file)
--- 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;