From: divverent Date: Wed, 6 Jun 2012 14:07:46 +0000 (+0000) Subject: Mem_Realloc: allow the pool to be NULL in which case the block's previous pool is... X-Git-Tag: xonotic-v0.8.0~96^2~213 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=51eb6a30cdd9bc1f8e3e6bfcfca87e22eafbf6fc;p=xonotic%2Fdarkplaces.git Mem_Realloc: allow the pool to be NULL in which case the block's previous pool is used git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11825 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/zone.c b/zone.c index 2f756d0e..16386369 100644 --- a/zone.c +++ b/zone.c @@ -382,7 +382,12 @@ void *_Mem_Alloc(mempool_t *pool, void *olddata, size_t size, size_t alignment, return NULL; } if (pool == NULL) - Sys_Error("Mem_Alloc: pool == NULL (alloc at %s:%i)", filename, fileline); + { + if(olddata) + pool = ((memheader_t *)((unsigned char *) olddata - sizeof(memheader_t)))->pool; + else + Sys_Error("Mem_Alloc: pool == NULL (alloc at %s:%i)", filename, fileline); + } if (mem_mutex) Thread_LockMutex(mem_mutex); if (developer_memory.integer)