]> granicus.if.org Git - php/commitdiff
- Fix leak when no fill is done (ilia)
authorPierre Joye <pajoye@php.net>
Wed, 23 Jul 2003 00:23:21 +0000 (00:23 +0000)
committerPierre Joye <pajoye@php.net>
Wed, 23 Jul 2003 00:23:21 +0000 (00:23 +0000)
ext/gd/libgd/gd.c

index a7b337a6508a4c7668bacd34d8c1540f20c0eb14..e2624bead34f990c82f68cc9351c0d5c857aac71 100644 (file)
@@ -1869,12 +1869,13 @@ void gdImageFill(gdImagePtr im, int x, int y, int nc)
                return;
        }
 
-       stack = (struct seg *)emalloc(sizeof(struct seg) * ((int)(im->sy*im->sx)/4)+1);
-       sp = stack;
-
        wx2=im->sx;wy2=im->sy;
        oc = gdImageGetPixel(im, x, y);
        if (oc==nc || x<0 || x>wx2 || y<0 || y>wy2) return;
+
+       stack = (struct seg *)emalloc(sizeof(struct seg) * ((int)(im->sy*im->sx)/4)+1);
+       sp = stack;
+
        /* required! */
        FILL_PUSH(y,x,x,1);
        /* seed segment (popped 1st) */