]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - util.c
util_memory_r with byte=0 will now call util_memory_d and return NULL
[xonotic/gmqcc.git] / util.c
diff --git a/util.c b/util.c
index e814ce646a33397179e8dcd52c503300636270c9..ec115cdddb4097897e49d6fd0bf64ca914f35506 100644 (file)
--- a/util.c
+++ b/util.c
@@ -86,6 +86,10 @@ void *util_memory_r(void *ptrn, unsigned int byte, unsigned int line, const char
 
     if (!ptrn)
         return util_memory_a(byte, line, file);
+    if (!byte) {
+        util_memory_d(ptrn, line, file);
+        return NULL;
+    }
 
     oldinfo = ((struct memblock_t*)ptrn - 1);
     newinfo = malloc(sizeof(struct memblock_t) + byte);