* argv.c (expandargv): Fix memory leak for expanded arguments.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259775 138bc75d-0d04-0410-961f-82ee72b054a4
This commit is contained in:
law 2018-04-30 18:00:49 +00:00 committed by Richard Earnshaw
parent 5969f0dba7
commit e4554bf702
2 changed files with 6 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2018-04-30 Daniel van Gerpen <daniel@vangerpen.de>
* argv.c (expandargv): Fix memory leak for copied argv.
2018-04-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2018-04-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR lto/81968 PR lto/81968

View file

@ -455,6 +455,8 @@ expandargv (int *argcp, char ***argvp)
file_argc = 0; file_argc = 0;
while (file_argv[file_argc]) while (file_argv[file_argc])
++file_argc; ++file_argc;
/* Free the original option's memory. */
free ((*argvp)[i]);
/* Now, insert FILE_ARGV into ARGV. The "+1" below handles the /* Now, insert FILE_ARGV into ARGV. The "+1" below handles the
NULL terminator at the end of ARGV. */ NULL terminator at the end of ARGV. */
*argvp = ((char **) *argvp = ((char **)