cvs: php-src /ext/standard basic_functions.c /main main.c php_main.h
| From: | Jani Taskinen | Date: | Sun, 09 Jan 2005 16:30:09 +0000 |
| Subject: | cvs: php-src /ext/standard basic_functions.c /main main.c php_main.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-29820@lists.php.net to get a copy of this message | ||
sniper Sun Jan 9 11:30:09 2005 EDT
Modified files:
/php-src/ext/standard basic_functions.c
/php-src/main main.c php_main.h
Log:
- Fix leaks with registered shutdown functions.
http://cvs.php.net/diff.php/php-src/ext/standard/basic_functions.c?r1=1.702&r2=1.703&ty=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.702 php-src/ext/standard/basic_functions.c:1.703
--- php-src/ext/standard/basic_functions.c:1.702 Sat Jan 8 15:44:23 2005
+++ php-src/ext/standard/basic_functions.c Sun Jan 9 11:30:08 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.702 2005/01/08 20:44:23 sniper Exp $ */
+/* $Id: basic_functions.c,v 1.703 2005/01/09 16:30:08 sniper Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -2282,14 +2282,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.615&r2=1.616&ty=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.615 php-src/main/main.c:1.616
--- php-src/main/main.c:1.615 Fri Dec 10 17:59:25 2004
+++ php-src/main/main.c Sun Jan 9 11:30:09 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.615 2004/12/10 22:59:25 andi Exp $ */
+/* $Id: main.c,v 1.616 2005/01/09 16:30:09 sniper Exp $ */
/* {{{ includes
*/
@@ -1131,11 +1131,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.32&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.32
--- 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:09 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.32 2005/01/09 16:30:09 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);