From 9eee3ec5bd7402b27b314158f8e565e525ccda42 Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Wed, 13 Mar 2024 16:19:46 +0000 Subject: [PATCH] apr_pools: Set APR_POOL_DEBUG's pool->owner before using the pool. The mutex synchronizing the pool in APR_POOL_DEBUG mode is created by apr_pool_create_ex_debug() on the created pool itself but before initialising the ->owner thread, so apr_thread_mutex_create() can abort() when reaching apr_pool_check_owner() if APR_POOL_DEBUG_OWNER is set. Move the ->owner initialisation before creating the ->mutex. Merges r1916278 from trunk. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.8.x@1916282 13f79535-47bb-0310-9956-ffa450edef68 --- memory/unix/apr_pools.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c index fbef277ad13..e93718d8f18 100644 --- a/memory/unix/apr_pools.c +++ b/memory/unix/apr_pools.c @@ -2028,6 +2028,13 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool, pool->tag = file_line; pool->file_line = file_line; +#if APR_HAS_THREADS + pool->owner = apr_os_thread_current(); +#endif /* APR_HAS_THREADS */ +#ifdef NETWARE + pool->owner_proc = (apr_os_proc_t)getnlmhandle(); +#endif /* defined(NETWARE) */ + #if APR_HAS_THREADS if (parent == NULL || parent->allocator != allocator) { apr_status_t rv; @@ -2067,13 +2074,6 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool, pool->ref = NULL; } -#if APR_HAS_THREADS - pool->owner = apr_os_thread_current(); -#endif /* APR_HAS_THREADS */ -#ifdef NETWARE - pool->owner_proc = (apr_os_proc_t)getnlmhandle(); -#endif /* defined(NETWARE) */ - #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) apr_pool_log_event(pool, "CREATE", file_line, 1); #endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */