gzopen leaks when specifying invalid mode

 [2012-02-19 14:22 UTC] nikic@php.net

Description:
------------
gzopen('someFile', 'c');

Leaks:

Warning: gzopen(): gzopen failed in 
/home/nikic/dev/Phuzzy/results/reproduceCode9_gzopen_memoryLeak.php on line 3
/home/nikic/dev/php-src/trunk/main/streams/streams.c(509) : Stream of type 
'STDIO' 0xb76e9024 (path:someFile) was not closed
[Sun Feb 19 15:20:17 2012]  Script:  'reproduceCode9_gzopen_memoryLeak.php'
/home/nikic/dev/php-src/trunk/main/streams/streams.c(273) :  Freeing 0xB76E9024 
(140 bytes), script=reproduceCode9_gzopen_memoryLeak.php
/home/nikic/dev/php-src/trunk/ext/zlib/zlib_fopen_wrapper.c(131) : Actual 
location (location was relayed)
=== Total 1 memory leaks detected ===


 [2012-02-19 14:41 UTC] nikic@php.net

Keeping open til merged to 5.4.

 [2012-02-19 14:41 UTC] nikic@php.net

-Assigned To: +Assigned To: nikic

 [2012-03-02 14:17 UTC] nikic@php.net

-Status: Assigned +Status: Closed

 [2012-07-29 06:17 UTC] laruence@php.net

valgrind complains :
==21723== Conditional jump or move depends on uninitialised value(s)
==21723==    at 0x3055402F6A: ??? (in /usr/lib64/libz.so.1.2.3)
==21723==    by 0x30554040A0: ??? (in /usr/lib64/libz.so.1.2.3)
==21723==    by 0x3055404184: gzdopen (in /usr/lib64/libz.so.1.2.3)
==21723==    by 0x572A0D: php_stream_gzopen (zlib_fopen_wrapper.c:137)
==21723==    by 0x5711C7: zif_gzopen (zlib.c:592)
==21723==    by 0x9A424E: zend_do_fcall_common_helper_SPEC 
(zend_vm_execute.h:642)
==21723==    by 0x9ADB2B: ZEND_DO_FCALL_SPEC_CONST_HANDLER 
(zend_vm_execute.h:2219)
==21723==    by 0x9A1E43: execute (zend_vm_execute.h:410)
==21723==    by 0x95C1A9: zend_execute_scripts (zend.c:1289)
==21723==    by 0x89AAF3: php_execute_script (main.c:2473)
==21723==    by 0xAE4268: do_cli (php_cli.c:988)
==21723==    by 0xAE5700: main (php_cli.c:1364)
==21723==

 [2012-08-09 16:14 UTC] nikic@php.net

The invalid move occurs within zlib, so this is rather a 3rd party issue. The only thing we could do here is manually check whether the mode is valid.

 [2012-08-09 16:14 UTC] nikic@php.net

-Status: Re-Opened +Status: Closed