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

index 3bc3281ba008af8b9687ec297b7cc8ed8716e828..66e2e062beb64e23e15d1e5ff0f759ab5a38f0ae 100644 (file)
@@ -18,6 +18,7 @@
 #include <ast/sfstr.h>
 #include <ast/error.h>
 #include <cgraph/agxbuf.h>
+#include <cgraph/alloc.h>
 #include <cgraph/unreachable.h>
 #include <gvpr/parse.h>
 #include <stdbool.h>
@@ -389,7 +390,7 @@ parseCase(Sfio_t * str, char **guard, int *gline, char **action,
 static parse_block *addBlock (parse_block * last, char *stmt, int line,
        int n_nstmts, case_info *nodelist, int n_estmts, case_info *edgelist)
 {
-    parse_block* item = newof(0, parse_block, 1, 0);
+    parse_block* item = gv_alloc(sizeof(parse_block));
 
     item->l_beging = line;
     item->begg_stmt = stmt;