From 85c68ce7c98ce23b0f0512bc1c83ff4be86c3114 Mon Sep 17 00:00:00 2001 From: kramm Date: Tue, 13 Jan 2009 22:22:11 +0000 Subject: [PATCH] fixed a double free and a mem leak --- lib/devices/polyops.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/devices/polyops.c b/lib/devices/polyops.c index 1a71c1f..ab9aa8c 100644 --- a/lib/devices/polyops.c +++ b/lib/devices/polyops.c @@ -152,8 +152,8 @@ void polyops_fill(struct _gfxdevice*dev, gfxline_t*line, gfxcolor_t*color) if(i->clip) { gfxpoly_t*old = poly; - poly = gfxpoly_intersect(poly, i->clip->poly); - gfxpoly_free(poly); + poly = gfxpoly_intersect(poly, i->clip->poly); + gfxpoly_free(old); } addtounion(dev,poly); gfxline_t*gfxline = gfxpoly_to_gfxline(poly); @@ -259,6 +259,10 @@ gfxresult_t* polyops_finish(struct _gfxdevice*dev) { dbg("polyops_finish"); internal_t*i = (internal_t*)dev->internal; + + if(i->polyunion) { + gfxpoly_free(i->polyunion);i->polyunion=0; + } if(i->out) { return i->out->finish(i->out); } else { -- 1.7.10.4