Bug #65562 [Fbk->Opn]: memory leak in zend_parse_arg
Edit report at https://bugs.php.net/bug.php?id=65562&edit=1 ID: 65562 Updated by: johan...@php.net Reported by:rrh at newrelic dot com Summary:memory leak in zend_parse_arg -Status: Feedback +Status: Open Type: Bug Package:Performance problem Operating System: all PHP Version:5.5.3 Block user comment: N Private report: N New Comment: A cleaner patch might pass the quiet argument to zend_parse_arg_impl, this would safe the allocation in there. This also seems to be limited to C and f modifiers which, in PHP itself, aren't used in combination with ZEND_PARSE_PARAMS_QUIET. So for adding a test we might need a deug-build-only functionin zend_builtin_functions.c. This might need coordination with docs and their function detection scripts. And sorry if I'm a bit harsh, but 99% of the internal API bugs we get are user errors and this bug was sparse on information. Previous Comments: [2013-08-26 23:14:26] s...@php.net Waiting feedback on the patch [2013-08-26 23:07:33] rrh at newrelic dot com I will test the patch, and in the future come up with patches for your review. [2013-08-26 23:02:38] yohg...@php.net I suspect you have pointer issue. Valgrind does not handle ***(pointer to pointer to pointer) well. Check your hash handling code carefully, it may help. [2013-08-26 23:02:10] johan...@php.net meant to write "your problem" :-) [2013-08-26 23:01:42] johan...@php.net https://github.com/johannes/php-src/commit/3bfe148c83d6c9b4134ac4fc5f6e0ae36f3f2c42 This might fix your issue. As you won't be telling whether this is our problem I can't properly test it. I'd welcome if you could test it and in future help providing patches. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=65562 -- Edit this bug report at https://bugs.php.net/bug.php?id=65562&edit=1
Bug #65562 [Fbk->Opn]: memory leak in zend_parse_arg
Edit report at https://bugs.php.net/bug.php?id=65562&edit=1 ID: 65562 User updated by:rrh at newrelic dot com Reported by:rrh at newrelic dot com Summary:memory leak in zend_parse_arg -Status: Feedback +Status: Open Type: Bug Package:Performance problem Operating System: all PHP Version:5.5.3 Block user comment: N Private report: N New Comment: I will test the patch, and in the future come up with patches for your review. Previous Comments: [2013-08-26 23:02:38] yohg...@php.net I suspect you have pointer issue. Valgrind does not handle ***(pointer to pointer to pointer) well. Check your hash handling code carefully, it may help. [2013-08-26 23:02:10] johan...@php.net meant to write "your problem" :-) [2013-08-26 23:01:42] johan...@php.net https://github.com/johannes/php-src/commit/3bfe148c83d6c9b4134ac4fc5f6e0ae36f3f2c42 This might fix your issue. As you won't be telling whether this is our problem I can't properly test it. I'd welcome if you could test it and in future help providing patches. [2013-08-26 22:55:31] yohg...@php.net > It should be by using ext_skel shell script. It should be easy by using ext_skel shell script. [2013-08-26 22:54:27] yohg...@php.net If you are certain, please provide short and complete module code that leaks memory. (i.e. full module code that compiles as module) It should be by using ext_skel shell script. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=65562 -- Edit this bug report at https://bugs.php.net/bug.php?id=65562&edit=1
Bug #65562 [Fbk->Opn]: memory leak in zend_parse_arg
Edit report at https://bugs.php.net/bug.php?id=65562&edit=1 ID: 65562 User updated by:rrh at newrelic dot com Reported by:rrh at newrelic dot com Summary:memory leak in zend_parse_arg -Status: Feedback +Status: Open Type: Bug Package:Performance problem Operating System: all PHP Version:5.5.3 Block user comment: N Private report: N New Comment: I didn't provide code to show the issue because the issue is almost certainly independent of my module extension, and a quick inspection of the code looking at the control flow paths would show that efree isn't called on all paths leading to a return from the function. Previous Comments: [2013-08-26 20:53:04] johan...@php.net Please provide compilable code showing the issue. In general: We don't consider issues which can't be triggered by userspace code as bug but expect extension authors to provide patches to improve PHP. [2013-08-26 20:23:12] rrh at newrelic dot com Description: Function zend_parse_arg leaks memory, as discovered when I ran valgrind with php test cases designed to exercise a module we wrote. zend_parse_arg calls zend_parse_arg_impl. Unfortunately, not all control flow paths to the return in zend_parse_arg call efree to free up the memory allocated by zend_parse_arg_impl to hold the error string. In my case, quiet != 0, so the lone efree (which has 2 additional guards) is not called. -- Edit this bug report at https://bugs.php.net/bug.php?id=65562&edit=1