* argv.c (expandargv): Fix memory leak for expanded arguments.
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 Apr 2018 18:00:49 +0000 (18:00 +0000)
committerRichard Earnshaw <Richard.Earnshaw@arm.com>
Thu, 31 May 2018 09:12:00 +0000 (10:12 +0100)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259775 138bc75d-0d04-0410-961f-82ee72b054a4

libiberty/ChangeLog
libiberty/argv.c

index 742b2fa48d7fc555d7d1d6841290abf2be609d18..a116d3731001820598e66af2e55494c2b2580808 100644 (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>
 
        PR lto/81968
index 4f66c8979b2a5ee5fab8a62c9ea36682116e575a..8ead947a11bfb9e66e19c299ceb7ebc590e9e9e7 100644 (file)
@@ -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 **) 
This page took 0.027824 seconds and 4 git commands to generate.