mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
engine: fix uninitialized variable in demo parsing code, fix incorrect size counter in memory allocator
This commit is contained in:
parent
772f4dcb60
commit
3ad60a0fa1
@ -888,7 +888,7 @@ qboolean CL_DemoReadMessage( byte *buffer, size_t *length )
|
|||||||
qboolean swallowmessages = true;
|
qboolean swallowmessages = true;
|
||||||
static int tdlastdemoframe = 0;
|
static int tdlastdemoframe = 0;
|
||||||
byte *userbuf = NULL;
|
byte *userbuf = NULL;
|
||||||
size_t size;
|
size_t size = 0;
|
||||||
byte cmd;
|
byte cmd;
|
||||||
|
|
||||||
if( !cls.demofile )
|
if( !cls.demofile )
|
||||||
|
@ -91,8 +91,8 @@ void *_Mem_Alloc( poolhandle_t poolptr, size_t size, qboolean clear, const char
|
|||||||
pool->totalsize += size;
|
pool->totalsize += size;
|
||||||
|
|
||||||
// big allocations are not clumped
|
// big allocations are not clumped
|
||||||
pool->realsize += sizeof( memheader_t ) + size + sizeof( int );
|
pool->realsize += sizeof( memheader_t ) + size + sizeof( size_t );
|
||||||
mem = (memheader_t *)Q_malloc( sizeof( memheader_t ) + size + sizeof( int ));
|
mem = (memheader_t *)Q_malloc( sizeof( memheader_t ) + size + sizeof( size_t ));
|
||||||
if( mem == NULL ) Sys_Error( "Mem_Alloc: out of memory (alloc at %s:%i)\n", filename, fileline );
|
if( mem == NULL ) Sys_Error( "Mem_Alloc: out of memory (alloc at %s:%i)\n", filename, fileline );
|
||||||
|
|
||||||
mem->filename = filename;
|
mem->filename = filename;
|
||||||
@ -162,7 +162,7 @@ static void Mem_FreeBlock( memheader_t *mem, const char *filename, int fileline
|
|||||||
// memheader has been unlinked, do the actual free now
|
// memheader has been unlinked, do the actual free now
|
||||||
pool->totalsize -= mem->size;
|
pool->totalsize -= mem->size;
|
||||||
|
|
||||||
pool->realsize -= sizeof( memheader_t ) + mem->size + sizeof( int );
|
pool->realsize -= sizeof( memheader_t ) + mem->size + sizeof( size_t );
|
||||||
Q_free( mem );
|
Q_free( mem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user