[PATCH] libiberty/argv.c: Use freeargv() instead of free() to avoid memory leak.

DJ Delorie dj@redhat.com
Wed Jan 28 21:19:00 GMT 2015


>      memcpy (*argvp + i, file_argv, file_argc * sizeof (char *));

This code copies all the pointers in file_argv[] into argv[], so if
you freeargv them via file_argv, argv[] will point to free'd memory.
Hence the comment:

>       /* Free up memory allocated to process the response file.  We do
> 	 not use freeargv because the individual options in FILE_ARGV
> 	 are now in the main ARGV.  */



More information about the Binutils mailing list