aboutsummaryrefslogtreecommitdiff
path: root/libiberty/argv.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2018-04-30 18:00:49 +0000
committerRichard Earnshaw <Richard.Earnshaw@arm.com>2018-05-31 10:12:00 +0100
commite4554bf70235e3ebb10521ddbcbb2bf17abe4865 (patch)
treead4eb59b9b96ab9b33a38e2e04d4c406a71146cf /libiberty/argv.c
parent5969f0dba74e17c694faf333b120f1e0b95783ed (diff)
downloadgdb-e4554bf70235e3ebb10521ddbcbb2bf17abe4865.zip
gdb-e4554bf70235e3ebb10521ddbcbb2bf17abe4865.tar.gz
gdb-e4554bf70235e3ebb10521ddbcbb2bf17abe4865.tar.bz2
* 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
Diffstat (limited to 'libiberty/argv.c')
-rw-r--r--libiberty/argv.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libiberty/argv.c b/libiberty/argv.c
index 4f66c89..8ead947 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 **)