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 | |
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.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elfxx-x86.c | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0eb514d..b39acb1 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2019-08-23 Alan Modra <amodra@gmail.com> + + PR 24933 + * elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Don't exit + on error without freeing plts[] contents. + 2019-08-22 Dennis Zhang <dennis.zhang@arm.com> * cpu-arm.c: New entries for Cortex-M35P, Cortex-A77, Cortex-A76AE. 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 *), |