Skip to content

Commit 9a826a3

Browse files
committed
Fix memory leak in imagescale()
1 parent f423e1b commit 9a826a3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

NEWS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ PHP NEWS
1010
. Fixed bug #72135 (Integer Overflow in php_html_entities). (Stas)
1111

1212
- GD:
13-
. Fixed bug ##72227 (imagescale out-of-bounds read). (Stas)
13+
. Fixed bug #72227 (imagescale out-of-bounds read). (Stas)
1414

1515
- Intl:
1616
. Fixed bug #72241 (get_icu_value_internal out-of-bounds read). (Stas)

ext/gd/libgd/gd_interpolation.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,12 +1070,12 @@ gdImagePtr gdImageScaleTwoPass(const gdImagePtr src, const unsigned int src_widt
10701070

10711071
dst = gdImageCreateTrueColor(new_width, new_height);
10721072
if (dst == NULL) {
1073-
gdFree(tmp_im);
1073+
gdImageDestroy(tmp_im);
10741074
return NULL;
10751075
}
10761076
gdImageSetInterpolationMethod(dst, src->interpolation_id);
10771077
_gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height);
1078-
gdFree(tmp_im);
1078+
gdImageDestroy(tmp_im);
10791079

10801080
return dst;
10811081
}
@@ -1093,7 +1093,7 @@ gdImagePtr Scale(const gdImagePtr src, const unsigned int src_width, const unsig
10931093
_gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height);
10941094
_gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height);
10951095

1096-
gdFree(tmp_im);
1096+
gdImageDestroy(tmp_im);
10971097
return dst;
10981098
}
10991099

0 commit comments

Comments
 (0)