From: Joe Orton Date: Tue, 8 Dec 2020 14:27:00 +0000 (+0000) Subject: Rearrange and clear global core config state allocated out of pconf X-Git-Tag: 2.5.0-alpha2-ci-test-only~1100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd08dcf1a8357eb3b1e862eaad13d9ac0c621cb2;p=thirdparty%2Fapache%2Fhttpd.git Rearrange and clear global core config state allocated out of pconf from a single cleanup: * server/core.c (reset_config): Clear ap_runtime_dir here, rather than in register_hooks. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1884208 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/config.c b/server/config.c index 8de2cec945a..5f88ea5718e 100644 --- a/server/config.c +++ b/server/config.c @@ -59,7 +59,6 @@ AP_DECLARE_DATA const char *ap_server_argv0 = NULL; AP_DECLARE_DATA const char *ap_server_root = NULL; -AP_DECLARE_DATA const char *ap_runtime_dir = NULL; AP_DECLARE_DATA server_rec *ap_server_conf = NULL; AP_DECLARE_DATA apr_pool_t *ap_pglobal = NULL; diff --git a/server/core.c b/server/core.c index e2855540a5a..9f81d421f1e 100644 --- a/server/core.c +++ b/server/core.c @@ -127,15 +127,18 @@ AP_DECLARE_DATA int ap_document_root_check = 1; /* magic pointer for ErrorDocument xxx "default" */ static char errordocument_default; +/* Global state allocated out of pconf: variables here MUST be + * cleared/reset in reset_config(), a pconf cleanup, to avoid the + * variable getting reused after the pool is cleared. */ static apr_array_header_t *saved_server_config_defines = NULL; static apr_table_t *server_config_defined_vars = NULL; +AP_DECLARE_DATA const char *ap_runtime_dir = NULL; +static const char *core_state_dir; AP_DECLARE_DATA int ap_main_state = AP_SQ_MS_INITIAL_STARTUP; AP_DECLARE_DATA int ap_run_mode = AP_SQ_RM_UNKNOWN; AP_DECLARE_DATA int ap_config_generation = 0; -static const char *core_state_dir; - typedef struct { apr_ipsubnet_t *subnet; struct ap_logconf log; @@ -1489,6 +1492,7 @@ static apr_status_t reset_config(void *dummy) saved_server_config_defines = NULL; server_config_defined_vars = NULL; core_state_dir = NULL; + ap_runtime_dir = NULL; return APR_SUCCESS; } @@ -5863,7 +5867,6 @@ static int core_upgrade_storage(request_rec *r) static void register_hooks(apr_pool_t *p) { - ap_runtime_dir = NULL; errorlog_hash = apr_hash_make(p); ap_register_log_hooks(p); ap_register_config_hooks(p);