(svn r22041) -Codechange: add a check that we called PoolItem::CanAllocateItem() before actually allocating it

This commit is contained in:
smatz
2011-02-09 18:55:51 +00:00
parent cc42f068ab
commit 817392c9b0
3 changed files with 17 additions and 2 deletions

View File

@@ -123,6 +123,10 @@ DEFINE_POOL_METHOD(void *)::GetNew(size_t size)
{
size_t index = this->FindFirstFree();
#ifdef OTTD_ASSERT
assert(this->checked != 0);
this->checked--;
#endif /* OTTD_ASSERT */
if (index == NO_FREE_ITEM) {
error("%s: no more free items", this->name);
}