Bug #70431 [Opn]: Memory leak in php_ini.c

From: Date: Tue, 08 Sep 2015 06:49:28 +0000
Subject: Bug #70431 [Opn]: Memory leak in php_ini.c
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195867@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70431&edit=1 ID: 70431 Updated by: sixd@php.net Reported by: sixd@php.net Summary: Memory leak in php_ini.c Status: Open Type: Bug Package: Scripting Engine problem Operating System: Linux PHP Version: 7.0Git-2015-09-04 (Git) Block user comment: N Private report: N New Comment: 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)." Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#195867) next »