ObjectPool: fix regression

winpr allocation checks introduced a problem that lead to zero size
allocations in ObjectPool
This commit is contained in:
Bernhard Miklautz 2015-04-14 13:47:23 +02:00
parent 951a40b639
commit 1093f647d3

View File

@ -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;