]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_proxy_http2: follow up to r1883704.
authorYann Ylavic <ylavic@apache.org>
Sun, 22 Nov 2020 00:56:07 +0000 (00:56 +0000)
committerYann Ylavic <ylavic@apache.org>
Sun, 22 Nov 2020 00:56:07 +0000 (00:56 +0000)
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

modules/http2/mod_http2.c

index 7da3d8e128c8aed5192da39f44ad42d36ac03d3e..24f1585725174ff0c61783cfd14b1372d96ace6c 100644 (file)
@@ -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 */