diff options
author | Yann Ylavic <ylavic@apache.org> | 2018-01-19 09:26:00 +0100 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2018-01-19 09:26:00 +0100 |
commit | 3ff6f80d69b95285dcbaee27309feee466cce6a0 (patch) | |
tree | 7740fc4f7eb8bd758c8bc6b0e5ed59386f383509 | |
parent | get mod_brotli in build (diff) | |
download | apache2-3ff6f80d69b95285dcbaee27309feee466cce6a0.tar.xz apache2-3ff6f80d69b95285dcbaee27309feee466cce6a0.zip |
mpm_event: Follow up to r1821558.
Don't crash (in listener) if we can't create the ptrans allocator.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1821595 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | server/mpm/event/event.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index 8c4d1e058f..b272433aa1 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -2053,23 +2053,31 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy) if (ptrans == NULL) { /* create a new transaction pool for each accepted socket */ - apr_allocator_t *allocator; - - apr_allocator_create(&allocator); - apr_allocator_max_free_set(allocator, ap_max_mem_free); - apr_pool_create_ex(&ptrans, pconf, NULL, allocator); - if (ptrans == NULL) { + apr_allocator_t *allocator = NULL; + + rc = apr_allocator_create(&allocator); + if (rc == APR_SUCCESS) { + apr_allocator_max_free_set(allocator, + ap_max_mem_free); + rc = apr_pool_create_ex(&ptrans, pconf, NULL, + allocator); + if (rc == APR_SUCCESS) { + apr_pool_tag(ptrans, "transaction"); + apr_allocator_owner_set(allocator, ptrans); + } + } + if (rc != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_CRIT, rc, ap_server_conf, APLOGNO(03097) "Failed to create transaction pool"); - apr_allocator_destroy(allocator); + if (allocator) { + apr_allocator_destroy(allocator); + } resource_shortage = 1; signal_threads(ST_GRACEFUL); continue; } - apr_allocator_owner_set(allocator, ptrans); } - apr_pool_tag(ptrans, "transaction"); get_worker(&have_idle_worker, 1, &workers_were_busy); rc = lr->accept_func(&csd, lr, ptrans); |