From: Matthew Fernandez Date: Sun, 31 Jul 2022 16:14:14 +0000 (-0700) Subject: gml2gv nameOf: fix unchecked allocation X-Git-Tag: 5.0.1~19^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=01c089d640526ffe71bf336594b0ce6cd41a5398;p=graphviz gml2gv nameOf: fix unchecked allocation --- diff --git a/cmd/tools/gml2gv.c b/cmd/tools/gml2gv.c index cb94b65a0..1da26b68b 100644 --- a/cmd/tools/gml2gv.c +++ b/cmd/tools/gml2gv.c @@ -13,12 +13,10 @@ #include #include - +#include #include #include -#define N_NEW(n,t) calloc((n),sizeof(t)) - static int Verbose; static char* gname = ""; static FILE *outFile; @@ -144,7 +142,7 @@ nameOf (char* name, int cnt) return name; if (cnt) { if (!buf) - buf = N_NEW (strlen(name)+32,char); /* 32 to handle any integer plus null byte */ + buf = gv_calloc(strlen(name) + 32, sizeof(char)); // 32 to handle any integer plus null byte sprintf (buf, "%s%d", name, cnt); return buf; }