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] libiberty/argv.c: Use freeargv() instead of free() to avoid memory leak.


>      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.  */


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