This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] PR24933, Memory leak in elf_x86_64_get_synthetic_symtab
- From: Alan Modra <amodra at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 23 Aug 2019 10:02:07 -0000
- Subject: [binutils-gdb] PR24933, Memory leak in elf_x86_64_get_synthetic_symtab
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2600d80ccd04666f28608364be74d7ee552977ae
commit 2600d80ccd04666f28608364be74d7ee552977ae
Author: Alan Modra <amodra@gmail.com>
Date: Fri Aug 23 19:16:25 2019 +0930
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.
Diff:
---
bfd/ChangeLog | 6 ++++++
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 *),