ID:               24700
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jan at kneschke dot de
-Status:           Open
+Status:           Closed
 Bug Type:         Scripting Engine problem
 Operating System: Linux 2.4.x
 PHP Version:      4.3.3RC1
 New Comment:

Patch applied.



Previous Comments:
------------------------------------------------------------------------

[2003-07-18 01:55:56] jan at kneschke dot de

Description:
------------
I just used valgrind on a simple php script and found a small 
memory leaks in the Zend Engine 
 
A patch is attached below. 
 
1. double init of auto_globals in line 473 and 499 because of 
#ifndef ZTS  
 #define GLOBAL_AUTO_GLOBALS_TABLE        
CG(auto_globals) 
#endif 
 
2. a missing free 

Reproduce code:
---------------
$ valgrind --logfile-fd=1 -v --leak-check=yes --show-reachable=yes
~/projects/in-cvs/php4/sapi/cli/php -r "print 'a';"

Expected result:
----------------
no leaks :) 

Actual result:
--------------
Index: Zend/zend.c 
=================================================================== 
RCS file: /repository/Zend/Attic/zend.c,v 
retrieving revision 1.162.2.9 
diff -u -r1.162.2.9 zend.c 
--- Zend/zend.c 14 Jun 2003 09:27:34 -0000      1.162.2.9 
+++ Zend/zend.c 18 Jul 2003 06:47:51 -0000 
@@ -496,7 +496,6 @@ 
        zend_startup_constants(tsrm_ls); 
        GLOBAL_CONSTANTS_TABLE = EG(zend_constants); 
 #else 
-       zend_hash_init_ex(CG(auto_globals), 8, NULL, NULL, 1, 
0); 
        scanner_globals_ctor(&ini_scanner_globals 
TSRMLS_CC); 
        scanner_globals_ctor(&language_scanner_globals 
TSRMLS_CC); 
        zend_startup_constants(); 
Index: Zend/zend_ini.c 
=================================================================== 
RCS file: /repository/Zend/Attic/zend_ini.c,v 
retrieving revision 1.23.2.2 
diff -u -r1.23.2.2 zend_ini.c 
--- Zend/zend_ini.c     24 Mar 2003 14:53:13 -0000      
1.23.2.2 
+++ Zend/zend_ini.c     18 Jul 2003 06:47:52 -0000 
@@ -78,6 +78,7 @@ 
 ZEND_API int zend_ini_shutdown(TSRMLS_D) 
 { 
        zend_hash_destroy(EG(ini_directives)); 
+       free(EG(ini_directives)); 
        return SUCCESS; 
 } 
 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=24700&edit=1

Reply via email to