public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [RFA] ar.c (delete_members): Plug memory leak.
@ 2011-03-08 20:38 Michael Snyder
  2011-03-25 17:17 ` Nick Clifton
  2011-05-01 16:04 ` H.J. Lu
  0 siblings, 2 replies; 7+ messages in thread
From: Michael Snyder @ 2011-03-08 20:38 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 5 bytes --]

OK?


[-- Attachment #2: ar5.txt --]
[-- Type: text/plain, Size: 1153 bytes --]

2011-03-08  Michael Snyder  <msnyder@vmware.com>

	* ar.c (delete_members): Plug memory leak.

Index: ar.c
===================================================================
RCS file: /cvs/src/src/binutils/ar.c,v
retrieving revision 1.72
diff -u -p -r1.72 ar.c
--- ar.c	8 Dec 2010 05:05:30 -0000	1.72
+++ ar.c	8 Mar 2011 20:35:36 -0000
@@ -1117,6 +1121,7 @@ delete_members (bfd *arch, char **files_
   bfd_boolean found;
   bfd_boolean something_changed = FALSE;
   int match_count;
+  char *tmp = NULL;
 
   for (; *files_to_delete != NULL; ++files_to_delete)
     {
@@ -1138,8 +1143,9 @@ delete_members (bfd *arch, char **files_
       current_ptr_ptr = &(arch->archive_next);
       while (*current_ptr_ptr)
 	{
-	  if (FILENAME_CMP (normalize (*files_to_delete, arch),
-			    (*current_ptr_ptr)->filename) == 0)
+	  free (tmp);
+	  tmp = normalize (*files_to_delete, arch);
+	  if (FILENAME_CMP (tmp, (*current_ptr_ptr)->filename) == 0)
 	    {
 	      ++match_count;
 	      if (counted_name_mode
@@ -1176,6 +1182,7 @@ delete_members (bfd *arch, char **files_
     write_archive (arch);
   else
     output_filename = NULL;
+  free (tmp);
 }
 
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-05-02 12:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-08 20:38 [RFA] ar.c (delete_members): Plug memory leak Michael Snyder
2011-03-25 17:17 ` Nick Clifton
2011-05-01 15:50   ` Matthias Klose
2011-05-01 16:04 ` H.J. Lu
2011-05-01 16:13   ` H.J. Lu
2011-05-02  6:18     ` Alan Modra
2011-05-02 12:49       ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).