From: Matthew Fernandez Date: Sat, 24 Apr 2021 04:16:27 +0000 (-0700) Subject: stack-allocate a statically sized buffer X-Git-Tag: 2.47.2~13^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eb4a23ad4e66803daf2c8ed3c40d540735e4d8fa;p=graphviz stack-allocate a statically sized buffer 1000 bytes is not a lot to allocate on the stack on a modern platform. --- diff --git a/lib/sparse/DotIO.c b/lib/sparse/DotIO.c index 2d6dc86e1..1a4e0ee1f 100644 --- a/lib/sparse/DotIO.c +++ b/lib/sparse/DotIO.c @@ -423,14 +423,13 @@ makeDotGraph (SparseMatrix A, char *name, int dim, real *x, int with_color, int Agnode_t** arr = N_NEW (A->m, Agnode_t*); real *color = NULL; char cstring[8]; - char *label_string; + char label_string[1000]; if (!name){ name = "stdin"; } else { name = strip_dir(name); } - label_string = MALLOC(sizeof(char)*1000); if (SparseMatrix_known_undirected(A)){ g = agopen ("G", Agundirected, 0); @@ -587,7 +586,6 @@ makeDotGraph (SparseMatrix A, char *name, int dim, real *x, int with_color, int FREE(color); FREE (arr); - FREE(label_string); return g; }