changeset 409:849f3846212a HEAD

Check return values for malloc()s and calloc()s.
author Timo Sirainen <tss@iki.fi>
date Sun, 13 Oct 2002 18:52:19 +0300
parents e057845d94ca
children 1f0e7229ee58
files src/lib/mempool-alloconly.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/mempool-alloconly.c	Sat Oct 12 01:33:54 2002 +0300
+++ b/src/lib/mempool-alloconly.c	Sun Oct 13 18:52:19 2002 +0300
@@ -97,6 +97,8 @@
 	len = strlen(name);
 
 	apool = calloc(SIZEOF_ALLOCONLYPOOL + len+1, 1);
+	if (apool == NULL)
+		i_panic("pool_alloconly_create(): Out of memory");
 	apool->pool = static_alloconly_pool;
 	apool->refcount = 1;
 
@@ -144,6 +146,8 @@
 	size = nearest_power(size);
 
 	block = calloc(size, 1);
+	if (block == NULL)
+		i_panic("block_alloc(): Out of memory");
 	block->prev = apool->block;
 	apool->block = block;