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

index b8ce26174140d60acb80a509d480d8a055755410..1776495849918b835887b67d821cedfdfb4c35eb 100644 (file)
@@ -17,6 +17,7 @@
 #include <gvpr/gprstate.h>
 #include <ast/error.h>
 #include <ast/sfstr.h>
+#include <cgraph/alloc.h>
 #include <stdbool.h>
 #include <stddef.h>
 
@@ -101,7 +102,7 @@ void addBindings (Gpr_t* state, gvprbinding* bindings)
     }
 
     if (n == 0) return;
-    bufp = buf = newof(0, gvprbinding, n, 0);
+    bufp = buf = gv_calloc(n, sizeof(gvprbinding));
     bp = bindings;
     while (bp->name) {
         if (bp->fn) {