diff options
author | Alan Modra <amodra@gmail.com> | 2019-08-23 19:16:25 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-08-23 19:29:51 +0930 |
commit | 2600d80ccd04666f28608364be74d7ee552977ae (patch) | |
tree | d57e17ec16070955b4cc9494cc673a454eb67684 /bfd/elfxx-x86.c | |
parent | fe4b77d9e5d27c046db95263ddcb5d34d1502359 (diff) | |
download | gdb-2600d80ccd04666f28608364be74d7ee552977ae.zip gdb-2600d80ccd04666f28608364be74d7ee552977ae.tar.gz gdb-2600d80ccd04666f28608364be74d7ee552977ae.tar.bz2 |
PR24933, Memory leak in elf_x86_64_get_synthetic_symtab
PR 24933
* elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Don't exit
on error without freeing plts[] contents.
Diffstat (limited to 'bfd/elfxx-x86.c')
-rw-r--r-- | bfd/elfxx-x86.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index 78ed41a..634f911 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -2171,17 +2171,18 @@ _bfd_x86_elf_get_synthetic_symtab (bfd *abfd, bfd_vma); bfd_boolean (*valid_plt_reloc_p) (unsigned int); + dynrelbuf = NULL; if (count == 0) - return -1; + goto bad_return; dynrelbuf = (arelent **) bfd_malloc (relsize); if (dynrelbuf == NULL) - return -1; + goto bad_return; dynrelcount = bfd_canonicalize_dynamic_reloc (abfd, dynrelbuf, dynsyms); if (dynrelcount <= 0) - return -1; + goto bad_return; /* Sort the relocs by address. */ qsort (dynrelbuf, dynrelcount, sizeof (arelent *), |