From: John Ellson Date: Thu, 5 Sep 2013 02:05:58 +0000 (-0400) Subject: possible fix for memory corruption - Redhat BZ#847458 X-Git-Tag: LAST_LIBGRAPH~32^2~39 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26ace1c4f3bbfad2dcf22225d9bf4e11b3bd0849;p=graphviz possible fix for memory corruption - Redhat BZ#847458 --- diff --git a/lib/gvc/gvevent.c b/lib/gvc/gvevent.c index 97305e2b4..b9e398135 100644 --- a/lib/gvc/gvevent.c +++ b/lib/gvc/gvevent.c @@ -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);