apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1402907 - /apr/apr/trunk/buckets/apr_buckets_alloc.c
Date Sat, 27 Oct 2012 22:56:41 GMT
Author: sf
Date: Sat Oct 27 22:56:41 2012
New Revision: 1402907

URL: http://svn.apache.org/viewvc?rev=1402907&view=rev
Log:
If out of mem, abort instead of crashing. Use the pool's abort function
if it has one.

Modified:
    apr/apr/trunk/buckets/apr_buckets_alloc.c

Modified: apr/apr/trunk/buckets/apr_buckets_alloc.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/buckets/apr_buckets_alloc.c?rev=1402907&r1=1402906&r2=1402907&view=diff
==============================================================================
--- apr/apr/trunk/buckets/apr_buckets_alloc.c (original)
+++ apr/apr/trunk/buckets/apr_buckets_alloc.c Sat Oct 27 22:56:41 2012
@@ -57,11 +57,14 @@ APR_DECLARE_NONSTD(apr_bucket_alloc_t *)
     apr_allocator_t *allocator;
     apr_bucket_alloc_t *list;
 
-    if (apr_allocator_create(&allocator) != APR_SUCCESS) {
-        abort();
+    if (apr_allocator_create(&allocator) != APR_SUCCESS
+        || (list = apr_bucket_alloc_create_ex(allocator)) == NULL) {
+        apr_abortfunc_t fn = apr_pool_abort_get(p);
+        if (fn)
+            (fn)(APR_ENOMEM);
+        else
+            abort();
     }
-
-    list = apr_bucket_alloc_create_ex(allocator);
     list->pool = p;
     apr_pool_cleanup_register(list->pool, list, alloc_cleanup,
                               apr_pool_cleanup_null);



Mime
View raw message