Mercurial > hg > CbC > CbC_gcc
diff libiberty/argv.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
line wrap: on
line diff
--- a/libiberty/argv.c Fri Oct 27 22:46:09 2017 +0900 +++ b/libiberty/argv.c Thu Oct 25 07:37:49 2018 +0900 @@ -1,5 +1,5 @@ /* Create and destroy argument vectors (argv's) - Copyright (C) 1992-2017 Free Software Foundation, Inc. + Copyright (C) 1992-2018 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support This file is part of the libiberty library. @@ -367,8 +367,8 @@ { /* The argument we are currently processing. */ int i = 0; - /* Non-zero if ***argvp has been dynamically allocated. */ - int argv_dynamic = 0; + /* To check if ***argvp has been dynamically allocated. */ + char ** const original_argv = *argvp; /* Limit the number of response files that we parse in order to prevent infinite recursion. */ unsigned int iteration_limit = 2000; @@ -449,12 +449,14 @@ /* Parse the string. */ file_argv = buildargv (buffer); /* If *ARGVP is not already dynamically allocated, copy it. */ - if (!argv_dynamic) + if (*argvp == original_argv) *argvp = dupargv (*argvp); /* Count the number of arguments. */ 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 **)