From 1093f647d39dbd969b1902bf358cfcf26e5ce2c8 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Tue, 14 Apr 2015 13:47:23 +0200 Subject: [PATCH] ObjectPool: fix regression winpr allocation checks introduced a problem that lead to zero size allocations in ObjectPool --- winpr/libwinpr/utils/collections/ObjectPool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winpr/libwinpr/utils/collections/ObjectPool.c b/winpr/libwinpr/utils/collections/ObjectPool.c index f871729da..3839970f2 100644 --- a/winpr/libwinpr/utils/collections/ObjectPool.c +++ b/winpr/libwinpr/utils/collections/ObjectPool.c @@ -127,6 +127,8 @@ wObjectPool* ObjectPool_New(BOOL synchronized) if (pool) { + pool->capacity = 32; + pool->size = 0; pool->array = (void**) malloc(sizeof(void*) * pool->capacity); if (!pool->array) { @@ -138,8 +140,6 @@ wObjectPool* ObjectPool_New(BOOL synchronized) if (pool->synchronized) InitializeCriticalSectionAndSpinCount(&pool->lock, 4000); - pool->size = 0; - pool->capacity = 32; } return pool;