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]

Re: [RFA] ar.c (map_over_members): Plug memory leak.


Michael Snyder <msnyder@vmware.com> writes:
> OK?
>
> 2011-03-08  Michael Snyder  <msnyder@vmware.com>
>
> 	* ar.c (map_over_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:24:33 -0000
> @@ -199,9 +199,10 @@ map_over_members (bfd *arch, void (*func
>        match_count = 0;
>        for (head = arch->archive_next; head; head = head->archive_next)
>  	{
> -	  const char * filename;
> +	  const char * filename = NULL;
>  
>  	  PROGRESS (1);
> +	  free (filename);
>  	  filename = head->filename;
>  	  if (filename == NULL)
>  	    {
> @@ -237,6 +238,7 @@ map_over_members (bfd *arch, void (*func
>  	/* xgettext:c-format */
>  	fprintf (stderr, _("no entry %s in archive\n"), *files);
>      }
> +  free (filename);
>  }
>  
>  bfd_boolean operation_alters_arch = FALSE;

Maybe I'm being dense, but I don't get this.  Does it even compile?

Richard


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