]> granicus.if.org Git - graphviz/commitdiff
core plugin insert: fix unchecked allocation failure
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 4 Sep 2022 19:34:47 +0000 (12:34 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 5 Sep 2022 22:27:17 +0000 (15:27 -0700)
plugin/core/gvrender_core_json.c

index 560337fcc19ff0aa7a1a91b62afe6be2bfac4e45..4b7438bb83ee2c2cefa9d1d8206fedab2d00dd93 100644 (file)
@@ -34,8 +34,6 @@
 #include <gvc/gvio.h>
 #include <gvc/gvcint.h>
 
-#include <common/memory.h>
-
 typedef enum {
        FORMAT_JSON,
        FORMAT_JSON0,
@@ -615,7 +613,7 @@ static void insert (Dt_t* map, char* name, int v)
            agerr(AGWARN, "Duplicate cluster name \"%s\"\n", name);
        return;
     }
-    ip = calloc(1, sizeof(intm));
+    ip = gv_alloc(sizeof(intm));
     ip->id = strdup(name);
     ip->v = v;
     dtinsert (map, ip);