]> granicus.if.org Git - graphviz/commitdiff
gvpr scanArgs: fix unchecked allocation failure
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 27 Aug 2022 22:30:16 +0000 (15:30 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 30 Aug 2022 03:01:58 +0000 (20:01 -0700)
lib/gvpr/gvpr.c

index b5cacd47f4514b304c252f2add09b5d7adbefdf4..aee9a484f40fbe5cde4d50c1177aa6bba0e8af1e 100644 (file)
@@ -375,7 +375,6 @@ static void freeOpts(options opts) {
  */
 static options scanArgs(int argc, char **argv) {
     int i, nfiles;
-    char** input_filenames;
     char* arg;
     options opts = {0};
 
@@ -390,7 +389,7 @@ static options scanArgs(int argc, char **argv) {
     for (i = 1; i < argc; i++)
        if (argv[i] && argv[i][0] != '-')
            nfiles++;
-    input_filenames = newof(0,char*,nfiles + 1,0);
+    char** input_filenames = gv_calloc(nfiles + 1, sizeof(char*));
 
     /* loop over arguments */
     nfiles = 0;