]> granicus.if.org Git - graphviz/commitdiff
neatogen embed_graph: remove free of output parameter
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 22 Dec 2022 03:00:31 +0000 (19:00 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 25 Dec 2022 01:17:08 +0000 (17:17 -0800)
The only call into this function passes `NULL` for the `coords` parameter.
Additionally it did not make much sense to free this pointer on behalf of the
caller. This function is not designed to be called in a loop, so if the caller
wants their passed-in parameter freed they should do it themselves prior to
calling.

lib/neatogen/embed_graph.c

index 9f9ac91e4cf0ad4bb3b70a1477f96d61f9abdad9..b1d4c222b42ddbbd2d8fd8a1bc9a641437e99cbd 100644 (file)
@@ -45,11 +45,6 @@ void embed_graph(vtx_data * graph, int n, int dim, DistType *** Coords,
     Queue Q;
     DistType max_dist = 0;
 
-    if (coords != NULL) {
-       free(coords[0]);
-       free(coords);
-    }
-
     /* this matrix stores the distance between each node and each "pivot" */
     *Coords = coords = N_GNEW(dim, DistType *);
     for (i = 0; i < dim; i++)