summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2016-05-24 16:12:01 -0700
committerStanislav Malyshev <stas@php.net>2016-05-24 16:12:01 -0700
commit9a826a3bd99315b7c4d4673acd3084c99eb04253 (patch)
tree7ed4eb58c2e58a724a6dec34d14af38e7f0c5fc2
parentf423e1bb895d64c50dc538e8cdc556324e8b8cc2 (diff)
downloadphp-git-9a826a3bd99315b7c4d4673acd3084c99eb04253.tar.gz
Fix memory leak in imagescale()
-rw-r--r--NEWS2
-rw-r--r--ext/gd/libgd/gd_interpolation.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index f824cea0e0..afc6fa77d9 100644
--- a/NEWS
+++ b/NEWS
@@ -10,7 +10,7 @@ PHP NEWS
. Fixed bug #72135 (Integer Overflow in php_html_entities). (Stas)
- GD:
- . Fixed bug ##72227 (imagescale out-of-bounds read). (Stas)
+ . Fixed bug #72227 (imagescale out-of-bounds read). (Stas)
- Intl:
. Fixed bug #72241 (get_icu_value_internal out-of-bounds read). (Stas)
diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c
index a017498383..0961c08048 100644
--- a/ext/gd/libgd/gd_interpolation.c
+++ b/ext/gd/libgd/gd_interpolation.c
@@ -1070,12 +1070,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;
}
@@ -1093,7 +1093,7 @@ gdImagePtr Scale(const gdImagePtr src, const unsigned int src_width, const unsig
_gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height);
_gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height);
- gdFree(tmp_im);
+ gdImageDestroy(tmp_im);
return dst;
}