This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Free memory returned from bfd_get_synthetic_symtab
- From: H.J.Lu <hjl at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 25 Sep 2017 21:08:05 -0000
- Subject: [binutils-gdb] Free memory returned from bfd_get_synthetic_symtab
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8dba52b60488265e66073130ef77c03f05dcaabc
commit 8dba52b60488265e66073130ef77c03f05dcaabc
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Sep 25 14:07:01 2017 -0700
Free memory returned from bfd_get_synthetic_symtab
PR binutils/22203
* nm.c (display_rel_file): Free memory returned from
bfd_get_synthetic_symtab.
Diff:
---
binutils/ChangeLog | 6 ++++++
binutils/nm.c | 4 +++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 0374084..f7b8d70 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2017-09-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/22203
+ * nm.c (display_rel_file): Free memory returned from
+ bfd_get_synthetic_symtab.
+
2017-09-22 Alexandre Oliva <aoliva@redhat.com>
* dwarf.h (debug_info): Add loc_views and num_loc_views.
diff --git a/binutils/nm.c b/binutils/nm.c
index 5e03a8a..3328812 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -1094,6 +1094,7 @@ display_rel_file (bfd *abfd, bfd *archive_bfd)
void *minisyms;
unsigned int size;
struct size_sym *symsizes;
+ asymbol *synthsyms = NULL;
if (! dynamic)
{
@@ -1124,7 +1125,6 @@ display_rel_file (bfd *abfd, bfd *archive_bfd)
if (show_synthetic && size == sizeof (asymbol *))
{
- asymbol *synthsyms;
asymbol **static_syms = NULL;
asymbol **dyn_syms = NULL;
long static_count = 0;
@@ -1201,6 +1201,8 @@ display_rel_file (bfd *abfd, bfd *archive_bfd)
else
print_size_symbols (abfd, dynamic, symsizes, symcount, archive_bfd);
+ if (synthsyms)
+ free (synthsyms);
free (minisyms);
free (symsizes);
}