Bug #70431 [Asn->Csd]: Memory leak in php_ini.c
Edit report at https://bugs.php.net/bug.php?id=70431&edit=1
ID: 70431
Updated by: laruence@php.net
Reported by: sixd@php.net
Summary: Memory leak in php_ini.c
-Status: Assigned
+Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: Linux
PHP Version: 7.0Git-2015-09-04 (Git)
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a8368ddc38a1940e705914699478dd1f83e745ee
Log: Fixed bug #70431 (Memory leak in php_ini.c)
Previous Comments:
------------------------------------------------------------------------
[2015-09-08 06:49:22] sixd@php.net
From the reporter:
"This issue is reproducible only when run the test through "gmake test TESTS=%"
command and with valgrind option "--leak-check=full".
Basically leak occurs while php attempts to load the php config ini file, i.e., before it loads
actual testcase.
Please configure the run-tests.php to run Valgrind and make sure add "--leak-check=full"
in run-test.php in valgrind command present in line number 1882, 1884.
Then run test in ext/date as follow:
gmake test TESTS=ext/date
Even first testcase ext/date/tests/002.phpt will LEAK with the reported memory leak (definitely lost
category)."
------------------------------------------------------------------------
[2015-09-05 03:24:59] laruence@php.net
any script to reproduce this?
------------------------------------------------------------------------
[2015-09-04 20:59:42] sixd@php.net
Description:
------------
==12787== 51 bytes in 1 blocks are definitely lost in loss record 363 of 675
==12787== at 0x4A069EE: malloc (vg_replace_malloc.c:270)
==12787== by 0x681D37: _estrndup (zend_alloc.c:2516)
==12787== by 0x64E44D: expand_filepath_with_mode (fopen_wrappers.c:822)
==12787== by 0x650B8E: php_init_config (php_ini.c:555)
==12787== by 0x64A5A4: php_module_startup (main.c:2147)
==12787== by 0x73B3CC: php_cli_startup (php_cli.c:423)
==12787== by 0x73CEE3: main (php_cli.c:1322)
Fix (from @Senthil) is:
--- php_ini.c.orig 2015-09-05 00:02:16.000000000 +1000
+++ php_ini.c 2015-09-04 23:58:13.000000000 +1000
@@ -600,6 +600,8 @@
if (opened_path) {
zend_string_release(opened_path);
}
+ efree((char*) fh.filename);
+ fh.filename = (char *) NULL;
php_ini_opened_path = zend_strndup(Z_STRVAL(tmp), Z_STRLEN(tmp));
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70431&edit=1
Thread (4 messages)