]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - zone.c
Nevermind, we can't remove that STX char... just add \{3} for our purposes
[xonotic/darkplaces.git] / zone.c
diff --git a/zone.c b/zone.c
index 207132c100966588adcb7bd36ecc2a14198ed131..16386369c21c1694527a74f2a403457fa8f405d7 100644 (file)
--- a/zone.c
+++ b/zone.c
@@ -117,7 +117,7 @@ static void *mmap_malloc(size_t size)
        char *tmpdir = getenv("TEMP");
        mmap_data_t *data;
        int fd;
-       size += sizeof(mmap-data_t); // waste block
+       size += sizeof(mmap_data_t); // waste block
        dpsnprintf(vabuf, sizeof(vabuf), "%s/darkplaces.XXXXXX", tmpdir ? tmpdir : "/tmp");
        fd = mkstemp(vabuf);
        if(fd < 0)
@@ -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)