fixed a double free and a mem leak
authorkramm <kramm>
Sun, 6 Apr 2008 16:49:26 +0000 (16:49 +0000)
committerkramm <kramm>
Sun, 6 Apr 2008 16:49:26 +0000 (16:49 +0000)
lib/devices/polyops.c

index 1a71c1f..ab9aa8c 100644 (file)
@@ -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 {