From: Matthew Fernandez Date: Sun, 28 Aug 2022 16:04:12 +0000 (-0700) Subject: gvcolor color: fix unchecked allocation failure X-Git-Tag: 6.0.1~17^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ea742e49e660e2d298dc420a31468942298f33a9;p=graphviz gvcolor color: fix unchecked allocation failure --- diff --git a/cmd/tools/gvcolor.c b/cmd/tools/gvcolor.c index e0a1d872c..1cf5fc2d4 100644 --- a/cmd/tools/gvcolor.c +++ b/cmd/tools/gvcolor.c @@ -23,6 +23,7 @@ #define NC 3 /* size of HSB color vector */ #include +#include #include #include #include @@ -147,7 +148,7 @@ static void color(Agraph_t * g) nn = agnnodes(g); assert(nn >= 0); size_t nnodes = (size_t)nn; - nlist = malloc(nnodes * sizeof(Agnode_t *)); + nlist = gv_calloc(nnodes, sizeof(Agnode_t *)); size_t i = 0; for (n = agfstnode(g); n; n = agnxtnode(g, n)) { nlist[i++] = n;