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

From: Date: Sun, 09 Jan 2005 16:30:22 +0000
Subject: cvs: php-src(PHP_4_3) /ext/standard basic_functions.c /main main.c php_main.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-29822@lists.php.net to get a copy of this message
sniper Sun Jan 9 11:30:22 2005 EDT Modified files: (Branch: PHP_4_3) /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.543.2.45&r2=1.543.2.46&ty=u Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.543.2.45 php-src/ext/standard/basic_functions.c:1.543.2.46 --- php-src/ext/standard/basic_functions.c:1.543.2.45 Sat Jan 8 15:45:43 2005 +++ php-src/ext/standard/basic_functions.c Sun Jan 9 11:30:22 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.543.2.45 2005/01/08 20:45:43 sniper Exp $ */ +/* $Id: basic_functions.c,v 1.543.2.46 2005/01/09 16:30:22 sniper Exp $ */ #include "php.h" #include "php_streams.h" @@ -2161,14 +2161,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.512.2.57&r2=1.512.2.58&ty=u Index: php-src/main/main.c diff -u php-src/main/main.c:1.512.2.57 php-src/main/main.c:1.512.2.58 --- php-src/main/main.c:1.512.2.57 Sun Jan 9 11:12:23 2005 +++ php-src/main/main.c Sun Jan 9 11:30:22 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.512.2.57 2005/01/09 16:12:23 sniper Exp $ */ +/* $Id: main.c,v 1.512.2.58 2005/01/09 16:30:22 sniper Exp $ */ /* {{{ includes */ @@ -975,11 +975,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.23.2.1&r2=1.23.2.2&ty=u Index: php-src/main/php_main.h diff -u php-src/main/php_main.h:1.23.2.1 php-src/main/php_main.h:1.23.2.2 --- php-src/main/php_main.h:1.23.2.1 Tue Dec 31 11:26:17 2002 +++ php-src/main/php_main.h Sun Jan 9 11:30:22 2005 @@ -18,7 +18,7 @@ */ -/* $Id: php_main.h,v 1.23.2.1 2002/12/31 16:26:17 sebastian Exp $ */ +/* $Id: php_main.h,v 1.23.2.2 2005/01/09 16:30:22 sniper Exp $ */ #ifndef PHP_MAIN_H @@ -47,7 +47,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 (#29822) next »