httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1821595 - /httpd/httpd/trunk/server/mpm/event/event.c
Date Fri, 19 Jan 2018 08:26:00 GMT
Author: ylavic
Date: Fri Jan 19 08:26:00 2018
New Revision: 1821595

URL: http://svn.apache.org/viewvc?rev=1821595&view=rev
Log:
mpm_event: Follow up to r1821558.

Don't crash (in listener) if we can't create the ptrans allocator.


Modified:
    httpd/httpd/trunk/server/mpm/event/event.c

Modified: httpd/httpd/trunk/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1821595&r1=1821594&r2=1821595&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/event/event.c Fri Jan 19 08:26:00 2018
@@ -2053,23 +2053,31 @@ static void * APR_THREAD_FUNC listener_t
 
                     if (ptrans == NULL) {
                         /* create a new transaction pool for each accepted socket */
-                        apr_allocator_t *allocator;
+                        apr_allocator_t *allocator = NULL;
 
-                        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) {
+                        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);



Mime
View raw message