Bug #70064 [Ana->Csd]: imagescale(..., IMG_BICUBIC) leaks memory
| From: | cmb@php.net | Date: | Mon, 13 Jul 2015 16:39:55 +0000 |
| Subject: | Bug #70064 [Ana->Csd]: imagescale(..., IMG_BICUBIC) leaks memory | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-194406@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70064&edit=1
ID: 70064
Updated by: cmb@php.net
Reported by: cmb@php.net
Summary: imagescale(..., IMG_BICUBIC) leaks memory
-Status: Analyzed
+Status: Closed
Type: Bug
Package: GD related
Operating System: *
PHP Version: 7.0Git-2015-07-13 (Git)
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1a4722a89ee85be74af5086a7027b3ad1e0a55e8
Log: Fix #70064: imagescale(..., IMG_BICUBIC) leaks memory
Previous Comments:
------------------------------------------------------------------------
[2015-07-13 16:25:41] cmb@php.net
Well, actually the test script should have been:
<?php
$im = imagecreatetruecolor(256, 256);
imagedestroy(imagescale($im, 32, 32, IMG_BICUBIC));
imagedestroy($im);
?>
but that doesn't change the result. The problem is that a
temporary image is freed with gdFree() instead of
gdImageDestroy(). I've already reported that upstream[1].
[1] <https://github.com/libgd/libgd/issues/173>
------------------------------------------------------------------------
[2015-07-13 13:14:07] cmb@php.net
Description:
------------
Apparently, imagescale(..., IMG_BICUBIC) leaks memory.
Test script:
---------------
<?php
$im = imagecreatetruecolor(256, 256);
imagescale($im, 32, 32, IMG_BICUBIC);
imagedestroy($im);
?>
Expected result:
----------------
Actual result:
--------------
[Mon Jul 13 15:11:26 2015] Script: '/home/cmb/test.php'
/home/cmb/php-src/ext/gd/libgd/gd.c(202) : Freeing 0x7FC6B1657680 (32 bytes), s
cript=/home/cmb/test.php
/home/cmb/php-src/Zend/zend_alloc.c(2266) : Actual location (location was relaye
d)
Last leak repeated 255 times
[Mon Jul 13 15:11:26 2015] Script: '/home/cmb/test.php'
/home/cmb/php-src/ext/gd/libgd/gd.c(193) : Freeing 0x7FC6B165AE00 (2048 bytes),
script=/home/cmb/test.php
[Mon Jul 13 15:11:26 2015] Script: '/home/cmb/test.php'
/home/cmb/php-src/ext/gd/libgd/gd.c(194) : Freeing 0x7FC6B165B800 (2048 bytes),
script=/home/cmb/test.php
[Mon Jul 13 15:11:26 2015] Script: '/home/cmb/test.php'
/home/cmb/php-src/ext/gd/libgd/gd.c(201) : Freeing 0x7FC6B1680000 (128 bytes),
script=/home/cmb/test.php
/home/cmb/php-src/Zend/zend_alloc.c(2266) : Actual location (location was relaye
d)
Last leak repeated 255 times
=== Total 514 memory leaks detected ===
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70064&edit=1