Edit report at https://bugs.php.net/bug.php?id=61785&edit=1
ID: 61785
Comment by: reeze dot xia at gmail dot com
Reported by: reeze dot xia at gmail dot com
Summary: Memory leak when access a non-exists file without
router
Status: Open
Type: Bug
Package: Built-in web server
Operating System: ANY
PHP Version: 5.4.0
Block user comment: N
Private report: N
New Comment:
Hi,
I've attached a patch for this. and I fixe a typo in similar mem leak fix's
test.
@see https://github.com/php/php-src/pull/64
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2012-04-20 09:36:49] reeze dot xia at gmail dot com
Description:
------------
When access a non exists file in builtin web server. with --enable-debug it
report
leaks.
When send error page, It call php_output_deactivate() it disabled the
sent_headers
callback but it will emalloc default_content-type. then it leaks.
So I think set SG(sapi_headers).send_default_content_type to 0 temporary can
avoid
leaking.
Test script:
---------------
NONE
Expected result:
----------------
no leaks
Actual result:
--------------
PHP 5.4.1RC1-dev Development Server started at Fri Apr 20 17:23:52 2012
Listening on localhost:9999
Document root is /Users/reeze/Opensource/php-src
Press Ctrl-C to quit.
[Fri Apr 20 17:24:05 2012] ::1:56664 [404]: /no-exist.png - No such file or
directory
[Fri Apr 20 17:24:05 2012] ::1:56665 [404]: /favicon.ico - No such file or
directory
^C[Fri Apr 20 17:24:07 2012] Script: '-'
/Users/reeze/Opensource/php-src/main/SAPI.c(839) : Freeing 0x10A6B0208 (24
bytes), script=-
[Fri Apr 20 17:24:07 2012] Script: '-'
/Users/reeze/Opensource/php-src/Zend/zend_llist.c(39) : Freeing 0x10A6B04A8
(39
bytes), script=-
[Fri Apr 20 17:24:07 2012] Script: '-'
/Users/reeze/Opensource/php-src/main/SAPI.c(321) : Freeing 0x10A6B4758 (10
bytes), script=-
=== Total 3 memory leaks detected ===
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61785&edit=1