]> granicus.if.org Git - graphviz/commitdiff
possible fix for memory corruption - Redhat BZ#847458
authorJohn Ellson <ellson@research.att.com>
Thu, 5 Sep 2013 02:05:58 +0000 (22:05 -0400)
committerJohn Ellson <ellson@research.att.com>
Thu, 5 Sep 2013 02:05:58 +0000 (22:05 -0400)
lib/gvc/gvevent.c

index 97305e2b4116d84ba18e2af5521f4db9ee04979b..b9e398135ff2367bbc7c92e6de58621f73103525 100644 (file)
@@ -681,11 +681,13 @@ static void gvevent_read (GVJ_t * job, const char *filename, const char *layout)
        g = agread(f);
 #else /* WITH_CGRAPH */
        g = agread(f,NIL(Agdisc_t *));
+
 #endif /* WITH_CGRAPH */
        fclose(f);
     }
     if (!g)
        return;   /* FIXME - need some error handling */
+
     if (gvc->g) {
        gvle = gvc->layout.engine;
        if (gvle && gvle->cleanup)
@@ -693,6 +695,12 @@ static void gvevent_read (GVJ_t * job, const char *filename, const char *layout)
        graph_cleanup(gvc->g);
        agclose(gvc->g);
     }
+
+#ifdef WITH_CGRAPH
+    aginit (g, AGRAPH, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
+    aginit (g, AGNODE, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE);
+    aginit (g, AGEDGE, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE);
+#endif
     gvc->g = g;
     GD_gvc(g) = gvc;
     gvLayout(gvc, g, layout);