[Freeswitch-svn] [commit] r7307 - freeswitch/trunk/libs/apr-util/misc

Freeswitch SVN mikej at freeswitch.org
Sun Jan 20 16:49:01 EST 2008


Author: mikej
Date: Sun Jan 20 16:49:01 2008
New Revision: 7307

Modified:
   freeswitch/trunk/libs/apr-util/misc/apr_queue.c

Log:
return error instead of segfaulting on pool allocation failure when creating a queue.

Modified: freeswitch/trunk/libs/apr-util/misc/apr_queue.c
==============================================================================
--- freeswitch/trunk/libs/apr-util/misc/apr_queue.c	(original)
+++ freeswitch/trunk/libs/apr-util/misc/apr_queue.c	Sun Jan 20 16:49:01 2008
@@ -126,7 +126,9 @@
     }
 
     /* 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;



More information about the Freeswitch-svn mailing list