]> granicus.if.org Git - php/commitdiff
Fix #70064: imagescale(..., IMG_BICUBIC) leaks memory
authorChristoph M. Becker <cmb@php.net>
Mon, 13 Jul 2015 16:30:33 +0000 (18:30 +0200)
committerChristoph M. Becker <cmb@php.net>
Mon, 13 Jul 2015 16:30:33 +0000 (18:30 +0200)
A temporary image (tmp_im) is created with gdImageTrueColor() and freed with
gdFree() instead of gdImageDestroy(). Let's fix that.

ext/gd/libgd/gd_interpolation.c

index f9c8f88e706fcd57909e36abb546f87eab1e1af4..32d69f9c205a8158f5c6a7b390effc667a916cf1 100644 (file)
@@ -1073,12 +1073,12 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt
 
        dst = gdImageCreateTrueColor(new_width, new_height);
        if (dst == NULL) {
-               gdFree(tmp_im);
+               gdImageDestroy(tmp_im);
                return NULL;
        }
        gdImageSetInterpolationMethod(dst, src->interpolation_id);
        _gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height);
-       gdFree(tmp_im);
+       gdImageDestroy(tmp_im);
 
        return dst;
 }