cvs: php-src(PHP_5_0) /ext/standard basic_functions.c /main main.c php_main.h

From: Date: Sun, 09 Jan 2005 16:30:15 +0000
Subject: cvs: php-src(PHP_5_0) /ext/standard basic_functions.c /main main.c php_main.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-29821@lists.php.net to get a copy of this message
sniper Sun Jan 9 11:30:15 2005 EDT Modified files: (Branch: PHP_5_0) /php-src/ext/standard basic_functions.c /php-src/main main.c php_main.h Log: MFH: - Fix leaks with registered shutdown functions. http://cvs.php.net/diff.php/php-src/ext/standard/basic_functions.c?r1=1.673.2.10&r2=1.673.2.11&ty=u Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.673.2.10 php-src/ext/standard/basic_functions.c:1.673.2.11 --- php-src/ext/standard/basic_functions.c:1.673.2.10 Sat Jan 8 15:45:11 2005 +++ php-src/ext/standard/basic_functions.c Sun Jan 9 11:30:15 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.673.2.10 2005/01/08 20:45:11 sniper Exp $ */ +/* $Id: basic_functions.c,v 1.673.2.11 2005/01/09 16:30:15 sniper Exp $ */ #include "php.h" #include "php_streams.h" @@ -2188,14 +2188,21 @@ } } -void php_call_shutdown_functions(void) +void php_call_shutdown_functions(TSRMLS_D) { - TSRMLS_FETCH(); - if (BG(user_shutdown_function_names)) zend_try { zend_hash_apply(BG(user_shutdown_function_names), (apply_func_t) user_shutdown_function_call TSRMLS_CC); memcpy(&EG(bailout), &orig_bailout, sizeof(jmp_buf)); + php_free_shutdown_functions(TSRMLS_C); + } + zend_end_try(); +} + +void php_free_shutdown_functions(TSRMLS_D) +{ + if (BG(user_shutdown_function_names)) + zend_try { zend_hash_destroy(BG(user_shutdown_function_names)); FREE_HASHTABLE(BG(user_shutdown_function_names)); BG(user_shutdown_function_names) = NULL; http://cvs.php.net/diff.php/php-src/main/main.c?r1=1.604.2.6&r2=1.604.2.7&ty=u Index: php-src/main/main.c diff -u php-src/main/main.c:1.604.2.6 php-src/main/main.c:1.604.2.7 --- php-src/main/main.c:1.604.2.6 Fri Dec 10 18:06:06 2004 +++ php-src/main/main.c Sun Jan 9 11:30:15 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.604.2.6 2004/12/10 23:06:06 andi Exp $ */ +/* $Id: main.c,v 1.604.2.7 2005/01/09 16:30:15 sniper Exp $ */ /* {{{ includes */ @@ -1135,11 +1135,12 @@ { TSRMLS_FETCH(); if (PG(modules_activated)) zend_try { - php_call_shutdown_functions(); + php_call_shutdown_functions(TSRMLS_C); } zend_end_try(); if (PG(modules_activated)) { zend_deactivate_modules(TSRMLS_C); + php_free_shutdown_functions(TSRMLS_C); } zend_try { @@ -1191,11 +1192,12 @@ } zend_end_try(); if (PG(modules_activated)) zend_try { - php_call_shutdown_functions(); + php_call_shutdown_functions(TSRMLS_C); } zend_end_try(); if (PG(modules_activated)) { zend_deactivate_modules(TSRMLS_C); + php_free_shutdown_functions(TSRMLS_C); } zend_try { http://cvs.php.net/diff.php/php-src/main/php_main.h?r1=1.31&r2=1.31.2.1&ty=u Index: php-src/main/php_main.h diff -u php-src/main/php_main.h:1.31 php-src/main/php_main.h:1.31.2.1 --- php-src/main/php_main.h:1.31 Thu Jan 8 12:33:04 2004 +++ php-src/main/php_main.h Sun Jan 9 11:30:15 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_main.h,v 1.31 2004/01/08 17:33:04 sniper Exp $ */ +/* $Id: php_main.h,v 1.31.2.1 2005/01/09 16:30:15 sniper Exp $ */ #ifndef PHP_MAIN_H #define PHP_MAIN_H @@ -48,7 +48,8 @@ PHPAPI void php_html_puts(const char *str, uint siz TSRMLS_DC); -extern void php_call_shutdown_functions(void); +extern void php_call_shutdown_functions(TSRMLS_D); +extern void php_free_shutdown_functions(TSRMLS_D); /* environment module */ extern int php_init_environ(void);

« previous php.cvs (#29821) next »