From ea742e49e660e2d298dc420a31468942298f33a9 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 28 Aug 2022 09:04:12 -0700 Subject: [PATCH] gvcolor color: fix unchecked allocation failure --- cmd/tools/gvcolor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.50.1