mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
[zone] Move heap check to Z_TagMalloc
Since Z_Malloc uses Z_TagMalloc to do the work, this ensures the check is always run. Also, add the check to Z_Realloc when it needs to adjust an existing block.
This commit is contained in:
parent
b8c2b7f856
commit
2fcec6e5cb
1 changed files with 6 additions and 2 deletions
|
@ -202,8 +202,6 @@ Z_Malloc (memzone_t *zone, size_t size)
|
|||
{
|
||||
void *buf;
|
||||
|
||||
if (!developer || developer->int_val & SYS_dev)
|
||||
Z_CheckHeap (zone); // DEBUG
|
||||
buf = Z_TagMalloc (zone, size, 1);
|
||||
if (!buf) {
|
||||
const char *msg;
|
||||
|
@ -224,6 +222,9 @@ Z_TagMalloc (memzone_t *zone, size_t size, int tag)
|
|||
int requested_size = size;
|
||||
memblock_t *start, *rover, *new, *base;
|
||||
|
||||
if (!developer || developer->int_val & SYS_dev)
|
||||
Z_CheckHeap (zone); // DEBUG
|
||||
|
||||
if (!tag) {
|
||||
if (zone->error)
|
||||
zone->error (zone->data, "Z_TagMalloc: tried to use a 0 tag");
|
||||
|
@ -290,6 +291,9 @@ Z_Realloc (memzone_t *zone, void *ptr, size_t size)
|
|||
if (!ptr)
|
||||
return Z_Malloc (zone, size);
|
||||
|
||||
if (!developer || developer->int_val & SYS_dev)
|
||||
Z_CheckHeap (zone); // DEBUG
|
||||
|
||||
block = (memblock_t *) ((byte *) ptr - sizeof (memblock_t));
|
||||
if (block->id != ZONEID/* || block->id2 != ZONEID*/) {
|
||||
if (zone->error)
|
||||
|
|
Loading…
Reference in a new issue