From: Rainer Jung Date: Tue, 16 Jul 2019 20:38:18 +0000 (+0000) Subject: Fix crashes when running with debug APR (APR_POOL_DEBUG), X-Git-Tag: 2.5.0-alpha2-ci-test-only~1975 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da33fd570880c4cc90465b96936b2bb40af4b632;p=thirdparty%2Fapache%2Fhttpd.git Fix crashes when running with debug APR (APR_POOL_DEBUG), because all pools have NULL allocators then. This workaround is probably not very efficient, but is only used when we do APR_POOL_DEBUG and efficiency shouldn't be a big concern then. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1863179 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/util.c b/server/util.c index b5633475436..044b073bf58 100644 --- a/server/util.c +++ b/server/util.c @@ -2994,6 +2994,11 @@ AP_DECLARE(void) ap_varbuf_grow(struct ap_varbuf *vb, apr_size_t new_len) /* The required block is rather larger. Use allocator directly so that * the memory can be freed independently from the pool. */ allocator = apr_pool_allocator_get(vb->pool); + /* Happens if APR was compiled with APR_POOL_DEBUG */ + if (allocator == NULL) { + apr_allocator_create(&allocator); + ap_assert(allocator != NULL); + } if (new_len <= VARBUF_MAX_SIZE) new_node = apr_allocator_alloc(allocator, new_len + APR_ALIGN_DEFAULT(sizeof(*new_info)));