The layout allocates memory based on the dimension of the root graph,
but since the dimension was stored in the subgraph and the dimension
in the root graph defaulted to zero, too little memory was allocated.
An alternative solution would have been to use the dimension of the
subgraph, but this had other implications and the chosen solution is
the same as what the other two layout engines supporting the dim
attribute (neato and sfdp) use. Twopi always uses two dimensions.
This fixes the last memory issue detected by ASan in the
test_subgraph_layout test, which now runs without failures.
- Segmentation fault when running test example neatopack.c #1800
- Memory leak in dot when using clusters
- Memory leak in patchwork when using clusters
+- Subgraph layout and rendering
## [5.0.0] – 2022-07-07
{
setEdgeType (g, EDGETYPE_LINE);
/* GD_ndim(g) = late_int(g,agfindgraphattr(g,"dim"),2,2); */
- Ndim = GD_ndim(g)=2; /* The algorithm only makes sense in 2D */
+ Ndim = GD_ndim(agroot(g)) = 2; /* The algorithm only makes sense in 2D */
twopi_init_node_edge(g);
}
CREATE_TEST(neatopack)
CREATE_TEST(simple)
CREATE_TEST(subgraph_layout)
-set_tests_properties(test_subgraph_layout PROPERTIES WILL_FAIL true)
CREATE_TEST(subgraphs)