]> granicus.if.org Git - graphviz/commitdiff
gvgen mkTree: fix unchecked allocations
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 31 Jul 2022 16:05:37 +0000 (09:05 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 6 Aug 2022 01:01:38 +0000 (18:01 -0700)
cmd/tools/graph_generator.c

index 10f4013bcc1e4e7f4f0ce19b6b3a4c1dfac36544..a8b9645feb8bc861716f78ca90fefb3c2ee6193e 100644 (file)
@@ -547,10 +547,10 @@ typedef struct {
 static tree_t*
 mkTree (int sz)
 {
-    tree_t* tp = NEW(tree_t);
+    tree_t* tp = gv_alloc(sizeof(tree_t));
     tp->root = 0;
     tp->top = 0;
-    tp->p = N_NEW(sz,int);
+    tp->p = gv_calloc(sz, sizeof(int));
     return tp;
 }