This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] readelf.c (process_gnu_liblist): Stop memory leak.


OK?

2011-03-07  Michael Snyder  <msnyder@msnyder-server.eng.vmware.com>

	* readelf.c (process_gnu_liblist): Stop memory leak.

Index: readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.534
diff -u -p -r1.534 readelf.c
--- readelf.c	1 Mar 2011 00:02:32 -0000	1.534
+++ readelf.c	8 Mar 2011 01:27:07 -0000
@@ -11807,7 +11811,7 @@ process_gnu_liblist (FILE * file)
   Elf_Internal_Shdr * section;
   Elf_Internal_Shdr * string_sec;
   Elf32_External_Lib * elib;
-  char * strtab;
+  char * strtab = NULL;
   size_t strtab_size;
   size_t cnt;
   unsigned i;
@@ -11833,6 +11837,7 @@ process_gnu_liblist (FILE * file)
 	    break;
 	  string_sec = section_headers + section->sh_link;
 
+	  free (strtab);
 	  strtab = (char *) get_data (NULL, file, string_sec->sh_offset, 1,
                                       string_sec->sh_size,
                                       _("liblist string table"));
@@ -11886,6 +11891,7 @@ process_gnu_liblist (FILE * file)
 	}
     }
 
+  free (strtab);
   return 1;
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]