aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-06-07 09:41:57 +0930
committerAlan Modra <amodra@gmail.com>2023-06-07 11:05:11 +0930
commitc7e6669a5b29240b1e5f6fd2acc987fd75b71044 (patch)
treea008170f4b38de4db42fd74787c5937ec4065180 /bfd/elf.c
parentf5c0d77088ee2878813861b5b72fa64001f1831a (diff)
downloadgdb-c7e6669a5b29240b1e5f6fd2acc987fd75b71044.zip
gdb-c7e6669a5b29240b1e5f6fd2acc987fd75b71044.tar.gz
gdb-c7e6669a5b29240b1e5f6fd2acc987fd75b71044.tar.bz2
bfd/elf.c strtab memory leak
* elf.c (_bfd_elf_compute_section_file_positions): Free strtab on set_group_contents failure return path.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 81eb3ef..af2fb04 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;