This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Fix memory leak in ld ARM backend
- From: Thomas Preud'homme <thopre01 at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 6 Apr 2016 08:29:00 -0000
- Subject: [binutils-gdb] Fix memory leak in ld ARM backend
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=15dd01b1209ec92b361dd2547708dd17ffc2a786
commit 15dd01b1209ec92b361dd2547708dd17ffc2a786
Author: Thomas Preud'homme <thomas.preudhomme@arm.com>
Date: Wed Apr 6 09:26:42 2016 +0100
Fix memory leak in ld ARM backend
2016-04-06 Thomas Preud'homme <thomas.preudhomme@arm.com>
bfd/
* elf32-arm.c (elf32_arm_size_stubs): Move error_ret_free_local to be
a fall through from error_ret_free_internal. Free local_syms in
error_ret_free_local if allocated from bfd_elf_get_elf_syms ().
Diff:
---
bfd/ChangeLog | 6 ++++++
bfd/elf32-arm.c | 11 +++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4fd4b4c..ef4254f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2016-04-06 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * elf32-arm.c (elf32_arm_size_stubs): Move error_ret_free_local to be
+ a fall through from error_ret_free_internal. Free local_syms in
+ error_ret_free_local if allocated from bfd_elf_get_elf_syms ().
+
2016-04-05 Cupertino Miranda <cmiranda@synopsys.com>
* elf32-arc.c (plt_do_relocs_for_symbol): Changed.
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 81ebf67..1d506f6 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -5294,7 +5294,13 @@ elf32_arm_size_stubs (bfd *output_bfd,
error_ret_free_internal:
if (elf_section_data (section)->relocs == NULL)
free (internal_relocs);
- goto error_ret_free_local;
+ /* Fall through. */
+ error_ret_free_local:
+ if (local_syms != NULL
+ && (symtab_hdr->contents
+ != (unsigned char *) local_syms))
+ free (local_syms);
+ return FALSE;
}
hash = NULL;
@@ -5700,9 +5706,6 @@ elf32_arm_size_stubs (bfd *output_bfd,
htab->num_a8_erratum_fixes = 0;
}
return TRUE;
-
- error_ret_free_local:
- return FALSE;
}
/* Build all the stubs associated with the current output file. The