From eb4a23ad4e66803daf2c8ed3c40d540735e4d8fa Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Fri, 23 Apr 2021 21:16:27 -0700 Subject: [PATCH] stack-allocate a statically sized buffer 1000 bytes is not a lot to allocate on the stack on a modern platform. --- lib/sparse/DotIO.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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; } -- 2.40.0