From d4a2ab28a96557708eb9a862fd665aa9740b1d69 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Sun, 20 Jan 2008 21:49:01 +0000 Subject: [PATCH] return error instead of segfaulting on pool allocation failure when creating a queue. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7307 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/apr-util/misc/apr_queue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/apr-util/misc/apr_queue.c b/libs/apr-util/misc/apr_queue.c index a869cf9f3a..28d79afcb5 100644 --- a/libs/apr-util/misc/apr_queue.c +++ b/libs/apr-util/misc/apr_queue.c @@ -126,7 +126,9 @@ APU_DECLARE(apr_status_t) apr_queue_create(apr_queue_t **q, } /* Set all the data in the queue to NULL */ - queue->data = apr_pcalloc(a, queue_capacity * sizeof(void*)); + queue->data = apr_palloc(a, queue_capacity * sizeof(void*)); + if (!queue->data) return APR_ENOMEM; + memset(queue->data, 0, queue_capacity * sizeof(void*)); queue->bounds = queue_capacity; queue->nelts = 0; queue->in = 0;