diff options
author | Marcus Boerger <helly@php.net> | 2008-08-10 21:52:05 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2008-08-10 21:52:05 +0000 |
commit | aea4ea120fbf3539eed29363ea89242d472a0e75 (patch) | |
tree | bec7914cdcc450f413c1c6ccf1f7c986c03510b6 /Zend | |
parent | b9b83ec794f2377b25c8c407076d88a8e971c065 (diff) | |
download | php-git-aea4ea120fbf3539eed29363ea89242d472a0e75.tar.gz |
- Fix memleak, Zend's built-in functions get copied before we copy all
functions, thus ending up in the name and param definitions copied twice
because zend_register_funciton already copies them.
- Also Be able to deallocate Zend's built-in functions and do so when
appropriate.
- After unregistering Zend's built-in functions only dl() is left and that
seems to be fine.
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/zend.c | 8 | ||||
-rw-r--r-- | Zend/zend.h | 2 | ||||
-rw-r--r-- | Zend/zend_builtin_functions.c | 6 | ||||
-rw-r--r-- | Zend/zend_builtin_functions.h | 1 |
4 files changed, 11 insertions, 6 deletions
diff --git a/Zend/zend.c b/Zend/zend.c index b232bd32be..9cde763a82 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -1045,7 +1045,7 @@ static void unicode_globals_dtor(zend_unicode_globals *unicode_globals TSRMLS_DC void zend_init_opcodes_handlers(void); -int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions) /* {{{ */ +int zend_startup(zend_utility_functions *utility_functions, char **extensions) /* {{{ */ { #ifdef ZTS zend_compiler_globals *compiler_globals; @@ -1170,10 +1170,6 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions, i zend_init_exception_op(TSRMLS_C); #endif - if (start_builtin_functions) { - zend_startup_builtin_functions(TSRMLS_C); - } - zend_ini_startup(TSRMLS_C); #ifdef ZTS @@ -1209,6 +1205,7 @@ void zend_register_standard_ini_entries(TSRMLS_D) /* {{{ */ ucnv_close(UG(runtime_encoding_conv)); UG(runtime_encoding_conv) = old_runtime_encoding_conv; } + zend_startup_builtin_functions(TSRMLS_C); } /* }}} */ @@ -1248,6 +1245,7 @@ void zend_shutdown(TSRMLS_D) /* {{{ */ #endif zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC); zend_hash_graceful_reverse_destroy(&module_registry); + zend_shutdown_builtin_functions(TSRMLS_C); zend_hash_destroy(GLOBAL_FUNCTION_TABLE); zend_hash_destroy(GLOBAL_CLASS_TABLE); diff --git a/Zend/zend.h b/Zend/zend.h index c890cb240b..949fea3916 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -572,7 +572,7 @@ typedef int (*zend_write_func_t)(const char *str, uint str_length); /* default engine string type */ #define ZEND_STR_TYPE (UG(unicode) ? IS_UNICODE : IS_STRING) -int zend_startup(zend_utility_functions *utility_functions, char **extensions, int start_builtin_functions); +int zend_startup(zend_utility_functions *utility_functions, char **extensions); void zend_shutdown(TSRMLS_D); void zend_register_standard_ini_entries(TSRMLS_D); void zend_post_startup(TSRMLS_D); diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 715219a54c..bf1caf8a98 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -416,6 +416,12 @@ int zend_startup_builtin_functions(TSRMLS_D) /* {{{ */ } /* }}} */ +void zend_shutdown_builtin_functions(TSRMLS_D) /* {{{ */ +{ + zend_unregister_functions(builtin_functions, -1, NULL TSRMLS_CC); +} +/* }}} */ + /* {{{ proto string zend_version(void) U Get the version of the Zend Engine */ ZEND_FUNCTION(zend_version) diff --git a/Zend/zend_builtin_functions.h b/Zend/zend_builtin_functions.h index deb313eeb2..9729f42095 100644 --- a/Zend/zend_builtin_functions.h +++ b/Zend/zend_builtin_functions.h @@ -23,6 +23,7 @@ #define ZEND_BUILTIN_FUNCTIONS_H int zend_startup_builtin_functions(TSRMLS_D); +int zend_shutdown_builtin_functions(TSRMLS_D); BEGIN_EXTERN_C() ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int provide_object TSRMLS_DC); |