diff options
author | Zack Weinberg <zack@bitmover.com> | 1999-08-24 05:31:03 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 1999-08-24 05:31:03 +0000 |
commit | 3ed4f5ed4bdc1ae8516d343e6107fd45dbda2bea (patch) | |
tree | 65c1bc06ee191d88af076a0a0eb3747e55e2a1ef /gcc/cppspec.c | |
parent | 732d9b8ce25d6862e7931831afd4d74b20f63842 (diff) | |
download | gcc-3ed4f5ed4bdc1ae8516d343e6107fd45dbda2bea.tar.gz |
cppspec.c: Put a null pointer at the end of the new argv.
1999-08-23 22:23 -0700 Zack Weinberg <zack@bitmover.com>
* cppspec.c: Put a null pointer at the end of the new argv.
From-SVN: r28813
Diffstat (limited to 'gcc/cppspec.c')
-rw-r--r-- | gcc/cppspec.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/cppspec.c b/gcc/cppspec.c index 4ab043d2158..01273054005 100644 --- a/gcc/cppspec.c +++ b/gcc/cppspec.c @@ -194,7 +194,8 @@ lang_specific_driver (errfn, in_argc, in_argv, in_added_libraries) if (new_argc == argc) return; - new_argv = (char **) xmalloc (new_argc * sizeof(char *)); + /* One more slot for a terminating null. */ + new_argv = (char **) xmalloc ((new_argc + 1) * sizeof(char *)); new_argv[0] = argv[0]; j = 1; @@ -218,8 +219,9 @@ lang_specific_driver (errfn, in_argc, in_argv, in_added_libraries) } if (read_stdin) - new_argv[j] = "-"; + new_argv[j++] = "-"; + new_argv[j] = NULL; *in_argc = new_argc; *in_argv = new_argv; } |