From: Yann Ylavic Date: Sun, 22 Nov 2020 00:56:07 +0000 (+0000) Subject: mod_proxy_http2: follow up to r1883704. X-Git-Tag: 2.5.0-alpha2-ci-test-only~1135 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6697a018b2a38313c02d7f5b6679caa19c21dfbb;p=thirdparty%2Fapache%2Fhttpd.git mod_proxy_http2: follow up to r1883704. For event/worker MPMs, pchild uses pconf's allocator, so its is NULL. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1883707 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http2/mod_http2.c b/modules/http2/mod_http2.c index 7da3d8e128c..24f15857251 100644 --- a/modules/http2/mod_http2.c +++ b/modules/http2/mod_http2.c @@ -189,13 +189,16 @@ static void h2_child_init(apr_pool_t *pchild, server_rec *s) /* The allocator of pchild has no mutex with MPM prefork, but we need one * for h2 workers threads synchronization. Even though mod_http2 shouldn't * be used with prefork, better be safe than sorry, so forcibly set the - * mutex here. + * mutex here. For MPM event/worker, pchild has no allocator so pconf's + * is used, with its mutex. */ allocator = apr_pool_allocator_get(pchild); - mutex = apr_allocator_mutex_get(allocator); - if (!mutex) { - apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, pchild); - apr_allocator_mutex_set(allocator, mutex); + if (allocator) { + mutex = apr_allocator_mutex_get(allocator); + if (!mutex) { + apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, pchild); + apr_allocator_mutex_set(allocator, mutex); + } } /* Set up our connection processing */