The `build_skeleton` function inserts virtual nodes and edges into the
graph to be used by the clustering algorithms. The `expand_cluster`
function later installs real nodes or sub-clusters and deletes the
virtual nodes and edges by calling the `remove_rank_leaders` function
which removes these from the graph. However, it didn't free the data
allocated for them which caused several memory leaks.
- [Dot] Record shape+UTF+" | "=Eats spaces. #925
- Memory leak in osage
- Segmentation fault when running test example neatopack.c #1800
+- Memory leak in dot when using clusters
## [5.0.0] – 2022-07-07
v = GD_rankleader(g)[r];
/* remove the entire chain */
- while ((e = ND_out(v).list[0]))
+ while ((e = ND_out(v).list[0])) {
delete_fast_edge(e);
- while ((e = ND_in(v).list[0]))
+ free(e->base.data);
+ free(e);
+ }
+ while ((e = ND_in(v).list[0])) {
delete_fast_edge(e);
+ free(e);
+ }
delete_fast_node(dot_root(g), v);
+ free(ND_in(v).list);
+ free(ND_out(v).list);
+ free(v->base.data);
+ free(v);
GD_rankleader(g)[r] = NULL;
}
}