cppspec.c: Put a null pointer at the end of the new argv.
authorZack Weinberg <zack@bitmover.com>
Tue, 24 Aug 1999 05:31:03 +0000 (05:31 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Tue, 24 Aug 1999 05:31:03 +0000 (05:31 +0000)
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

gcc/ChangeLog
gcc/cppspec.c

index 0b58e4d81232a58a7fe66a39f1d99e7daf940a11..3b77de2c4713783b88758216e2526688e3b8e142 100644 (file)
@@ -1,3 +1,7 @@
+1999-08-23 22:23 -0700  Zack Weinberg  <zack@bitmover.com>
+
+       * cppspec.c: Put a null pointer at the end of the new argv.
+
 Mon Aug 23 21:23:24 1999  Jeffrey A Law  (law@cygnus.com)
 
        * configure.in: Remove code to select/de-select the haifa
index 4ab043d21582b7cf8bf20dff51497047f2afafd4..01273054005af2e45213cf890125c1844a5c03ca 100644 (file)
@@ -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;
 }