From be61728fa5716c7521cd30a291f5b5269c385ecc Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Sun, 9 Oct 2011 22:41:54 +0000 Subject: [PATCH] Check the return value from ap_run_create_connection in mpm_event. Add a todo in mpm_simple PR: 41194 Submitted by: Davi Arnaut git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1180737 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ server/mpm/event/event.c | 6 ++++++ server/mpm/simple/simple_io.c | 1 + 3 files changed, 10 insertions(+) diff --git a/CHANGES b/CHANGES index eb51027b4c..ffa8ca9ef0 100644 --- a/CHANGES +++ b/CHANGES @@ -12,6 +12,9 @@ Changes with Apache 2.3.15 PR 51714. [Stefan Fritsch, Jim Jagielski, Ruediger Pluem, Eric Covener, ] + *) mpm_event: Check the return value from ap_run_create_connection. + PR: 41194. [Davi Arnaut] + *) mod_mime_magic: Add signatures for PNG and SWF to the example config. PR: 48352. [Jeremy Wagner-Kaiser ] diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index 00084778d5..38b70dee5a 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -805,6 +805,12 @@ static int process_socket(apr_thread_t *thd, apr_pool_t * p, apr_socket_t * sock cs->bucket_alloc = apr_bucket_alloc_create(p); c = ap_run_create_connection(p, ap_server_conf, sock, conn_id, sbh, cs->bucket_alloc); + if (!c) { + apr_bucket_alloc_destroy(cs->bucket_alloc); + apr_pool_clear(p); + ap_push_pool(worker_queue_info, p); + return 1; + } apr_atomic_inc32(&connection_count); apr_pool_cleanup_register(c->pool, NULL, decrement_connection_count, apr_pool_cleanup_null); c->current_thread = thd; diff --git a/server/mpm/simple/simple_io.c b/server/mpm/simple/simple_io.c index 11f1a5b37b..5af7f2d916 100644 --- a/server/mpm/simple/simple_io.c +++ b/server/mpm/simple/simple_io.c @@ -208,6 +208,7 @@ static void *simple_io_setup_conn(apr_thread_t * thread, void *baton) scon->c = ap_run_create_connection(scon->pool, ap_server_conf, scon->sock, conn_id, sbh, scon->ba); + /* XXX: handle failure */ scon->c->cs = apr_pcalloc(scon->pool, sizeof(conn_state_t)); cs = scon->c->cs; -- 2.40.0