Frees context at right time without double freeing.
/* Reset magic_quotes_runtime */
PG(magic_quotes_runtime) = INI_BOOL("magic_quotes_runtime");
+ /* Setup default context */
+ FG(default_context) = NULL;
+
return SUCCESS;
}
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;
}
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;
- }
}