Memory leak when access a non-exists file without router

Bug #61785 Memory leak when access a non-exists file without router
Submitted: 2012-04-20 09:36 UTC Modified: 2012-04-20 16:06 UTC
From: reeze dot xia at gmail dot com Assigned: laruence (profile)
Status: Closed Package: Built-in web server
PHP Version: 5.4.0 OS: ANY
Private report: No CVE-ID: None

 [2012-04-20 09:36 UTC] 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 ===

Patches

Fixed-typo-in-test-php_cli_server_016 (last revision 2012-04-20 09:52 UTC by reeze dot xia at gmail dot com)
0001-Bug-61785-Memory-leak-when-access-a-non-exists-file-.patch (last revision 2012-04-20 09:50 UTC by reeze dot xia at gmail dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2012-04-20 09:53 UTC] reeze dot xia at gmail dot com

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.

 [2012-04-20 16:06 UTC] laruence@php.net

-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence