From: Daniel van Gerpen Date: Mon, 30 Apr 2018 18:00:49 +0000 (+0000) Subject: argv.c (expandargv): Fix memory leak for expanded arguments. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d6df811e5db4d0f2cfa27c33dd97bf0ab3fe0822;p=gcc.git argv.c (expandargv): Fix memory leak for expanded arguments. * argv.c (expandargv): Fix memory leak for expanded arguments. From-SVN: r259775 --- diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 742b2fa48d7..a116d373100 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +2018-04-30 Daniel van Gerpen + + * argv.c (expandargv): Fix memory leak for copied argv. + 2018-04-13 Rainer Orth PR lto/81968 diff --git a/libiberty/argv.c b/libiberty/argv.c index 4f66c8979b2..8ead947a11b 100644 --- a/libiberty/argv.c +++ b/libiberty/argv.c @@ -455,6 +455,8 @@ expandargv (int *argcp, char ***argvp) file_argc = 0; while (file_argv[file_argc]) ++file_argc; + /* Free the original option's memory. */ + free ((*argvp)[i]); /* Now, insert FILE_ARGV into ARGV. The "+1" below handles the NULL terminator at the end of ARGV. */ *argvp = ((char **)