]> granicus.if.org Git - graphviz/commitdiff
At present, if the graph has no nodes, no layout is done. But then if gvFreeLayout...
authorEmden Gansner <emdenrg@google.com>
Fri, 16 Dec 2016 20:02:23 +0000 (15:02 -0500)
committerEmden Gansner <emdenrg@google.com>
Fri, 16 Dec 2016 20:02:23 +0000 (15:02 -0500)
and there are subgraphs, dot_cleanup_graph assumes the subgraphs are bound to a Agraphinfo_t,
which doesn't exist.  The calls to free the associated memory cause a crash.

The simplest solution is to check that Agraphinfo_t exists in dot_cleanup_graph before using it.

lib/dotgen/dotinit.c

index c1f25e989c336ad8b48434da502f644f8b32341a..f56697c5e73e0224668d58ae942f407025b53bdc 100644 (file)
@@ -157,6 +157,7 @@ dot_cleanup_graph(graph_t * g)
     for (subg = agfstsubg(g); subg; subg = agnxtsubg(subg)) {
        dot_cleanup_graph(subg);
     }
+    if (! agbindrec(g, "Agraphinfo_t", 0, TRUE)) return;
     if (GD_clust(g)) free (GD_clust(g));
     if (GD_rankleader(g)) free (GD_rankleader(g));