Return-Path: Delivered-To: apmail-apr-cvs-archive@www.apache.org Received: (qmail 94497 invoked from network); 22 Jun 2004 16:49:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 22 Jun 2004 16:49:05 -0000 Received: (qmail 6395 invoked by uid 500); 22 Jun 2004 16:18:35 -0000 Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 6068 invoked by uid 500); 22 Jun 2004 16:18:33 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 5998 invoked by uid 500); 22 Jun 2004 16:18:32 -0000 Delivered-To: apmail-apr-util-cvs@apache.org Date: 22 Jun 2004 16:18:20 -0000 Message-ID: <20040622161820.66291.qmail@minotaur.apache.org> From: jorton@apache.org To: apr-util-cvs@apache.org Subject: cvs commit: apr-util/buckets apr_buckets_alloc.c X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N jorton 2004/06/22 09:18:20 Modified: buckets apr_buckets_alloc.c Log: * buckets/apr_buckets_alloc.c (apr_bucket_alloc_create, apr_bucket_alloc_destroy): Cope with a NULL pool->allocator in debug mode. Revision Changes Path 1.15 +19 -1 apr-util/buckets/apr_buckets_alloc.c Index: apr_buckets_alloc.c =================================================================== RCS file: /home/cvs/apr-util/buckets/apr_buckets_alloc.c,v retrieving revision 1.14 retrieving revision 1.15 diff -d -w -u -r1.14 -r1.15 --- apr_buckets_alloc.c 13 Feb 2004 09:55:25 -0000 1.14 +++ apr_buckets_alloc.c 22 Jun 2004 16:18:20 -0000 1.15 @@ -13,6 +13,8 @@ * limitations under the License. */ +#include + #include "apr_buckets.h" #include "apr_allocator.h" @@ -49,8 +51,18 @@ APU_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create(apr_pool_t *p) { apr_allocator_t *allocator = apr_pool_allocator_get(p); - apr_bucket_alloc_t *list = apr_bucket_alloc_create_ex(allocator); + apr_bucket_alloc_t *list; + +#ifdef APR_POOL_DEBUG + /* may be NULL for debug mode. */ + if (allocator == NULL) { + if (apr_allocator_create(&allocator) != APR_SUCCESS) { + abort(); + } + } +#endif + list = apr_bucket_alloc_create_ex(allocator); list->pool = p; apr_pool_cleanup_register(list->pool, list, alloc_cleanup, apr_pool_cleanup_null); @@ -82,6 +94,12 @@ } apr_allocator_free(list->allocator, list->blocks); + +#ifdef APR_POOL_DEBUG + if (list->pool && list->allocator != apr_pool_allocator_get(list->pool)) { + apr_allocator_destroy(list->allocator); + } +#endif } APU_DECLARE_NONSTD(void *) apr_bucket_alloc(apr_size_t size,