]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Free memory returned from bfd_get_synthetic_symtab
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 25 Sep 2017 21:07:01 +0000 (14:07 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 25 Sep 2017 21:07:01 +0000 (14:07 -0700)
PR binutils/22203
* nm.c (display_rel_file): Free memory returned from
bfd_get_synthetic_symtab.

binutils/ChangeLog
binutils/nm.c

index 037408440be6f3fe12d82e84a39143bacff8d824..f7b8d7076cf1eb2a2dd1a0296f549aa9602e98f1 100644 (file)
@@ -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.
index 5e03a8ae92d526d8b28048271835773d38c605af..3328812656f09261f9d023dff7f10e485350c591 100644 (file)
@@ -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);
 }