diff --git a/src/oldpool_func.h b/src/oldpool_func.h index fc08bf9ee2..3fbed16a74 100644 --- a/src/oldpool_func.h +++ b/src/oldpool_func.h @@ -44,6 +44,7 @@ template *Tpool> T *PoolItem *Tpool> bool PoolItem::CanAllocateItem(uint count) { uint last_minus_one = Tpool->GetSize() - 1; + uint orig_count = count; for (T *t = Tpool->Get(Tpool->first_free_index); count > 0 && t != NULL; t = ((uint)t->index < last_minus_one) ? Tpool->Get(t->index + 1U) : NULL) { if (!t->IsValid()) count--; @@ -52,7 +53,7 @@ template *Tpool> bool PoolItemAddBlockToPool()) return CanAllocateItem(count); + if (Tpool->AddBlockToPool()) return CanAllocateItem(orig_count); return false; }