Fix memory block not being moved to correct taglist with Z_ChangeTag
I didn't even notice this one at first, whoops! Also added proper checking to prevent this from happening again.
This commit is contained in:
1 parent
f2d5c14519
commit
fe2f2fcfdc
1 file changed
+12
@@ -580,6 +580,10 @@ void Z_CheckHeap(INT32 tag)
|
||||
HeapError(" has the wrong ID");
|
||||
}
|
||||
#endif
|
||||
if (block->tag != j)
|
||||
{
|
||||
HeapError(va(" block is contained in the wrong headlist (got: %d expected: %zu)", block->tag, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -616,6 +620,14 @@ void Z_ChangeTag(void *ptr, INT32 tag)
|
||||
I_Error("Internal memory management error: "
|
||||
"tried to make block purgable but it has no owner");
|
||||
|
||||
block->prev->next = block->next;
|
||||
block->next->prev = block->prev;
|
||||
|
||||
block->next = headlist[tag].next;
|
||||
block->prev = &headlist[tag];
|
||||
headlist[tag].next = block;
|
||||
block->next->prev = block;
|
||||
|
||||
block->tag = tag;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user