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: [PATCH] binutils/windres.c: Fix memory leak issue for xmalloc and free 'n'


Please help check this patch, when you have time.

Thanks.

On 11/13/2014 10:23 PM, Chen Gang wrote:
> After xmalloc 'n', if fopen() fails, need free 'n', or will cause memory
> leak.
> 
> 2014-11-13  Chen Gang  <gang.chen.5i5j@gmail.com>
> 
> 	* binutiles/windres.c (open_file_search): Fix memory leak issue
> 	for xmalloc and free 'n'.
> ---
>  binutils/windres.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/binutils/windres.c b/binutils/windres.c
> index 7fa90fc..10aa722 100644
> --- a/binutils/windres.c
> +++ b/binutils/windres.c
> @@ -204,6 +204,7 @@ open_file_search (const char *filename, const char *mode, const char *errmsg,
>  	      *real_filename = n;
>  	      return e;
>  	    }
> +	  free(n);
>  
>  	  if (errno != ENOENT)
>  	    break;
> 


-- 
Chen Gang

Open share and attitude like air water and life which God blessed


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