From: Sara Golemon Date: Wed, 21 May 2003 21:36:51 +0000 (+0000) Subject: Setup FG(default_context) in RINIT/RSHUTDOWN instead of fg_ctor/fg_dtor. X-Git-Tag: RELEASE_1_0_2~645 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=af5e2af752c6fca01688cdb8b9a34ec698d931ba;p=php Setup FG(default_context) in RINIT/RSHUTDOWN instead of fg_ctor/fg_dtor. Frees context at right time without double freeing. --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index edcdabf5c8..e07012dd27 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1196,6 +1196,9 @@ PHP_RINIT_FUNCTION(basic) /* Reset magic_quotes_runtime */ PG(magic_quotes_runtime) = INI_BOOL("magic_quotes_runtime"); + /* Setup default context */ + FG(default_context) = NULL; + return SUCCESS; } @@ -1244,6 +1247,11 @@ PHP_RSHUTDOWN_FUNCTION(basic) efree(BG(user_filter_map)); BG(user_filter_map) = NULL; } + + /* cleanup any default context that was created */ + if (FG(default_context)) { + php_stream_context_free(FG(default_context)); + } return SUCCESS; } diff --git a/ext/standard/file.c b/ext/standard/file.c index 055e83bd43..f31c3718de 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -137,15 +137,10 @@ static void file_globals_ctor(php_file_globals *file_globals_p TSRMLS_DC) FG(pclose_ret) = 0; FG(user_stream_current_filename) = NULL; FG(def_chunk_size) = PHP_SOCK_CHUNK_SIZE; - FG(default_context) = NULL; } static void file_globals_dtor(php_file_globals *file_globals_p TSRMLS_DC) { - if (FG(default_context)) { - /* This is being automagically freed elsewhere */ - FG(default_context) = NULL; - } }