shithub: choc

Download patch

ref: c878d6bc494457a2ca70f171a60d2ec5b85a9987
parent: 3e4c80912ec88eb597b61ebb3d8d2ef4496fe6a1
author: Simon Howard <fraggle@soulsphere.org>
date: Sun Aug 16 14:18:16 EDT 2015

wad: Free cached lumps on reload, don't release.

When reloading a PWAD we discard any lumps that were cached from
its previous incarnation. But it is important that we completely
free the cached lumps and eliminate them from the zone heap,
otherwise the zone memory system might try to free cached lumps
later on and mistakenly overwrite the owner pointer that is no
longer valid.

--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -612,12 +612,12 @@
         return;
     }
 
-    // We must release any lumps being held in the PWAD we're about to reload:
+    // We must free any lumps being cached from the PWAD we're about to reload:
     for (i = reloadlump; i < numlumps; ++i)
     {
         if (lumpinfo[i].cache != NULL)
         {
-            W_ReleaseLumpNum(i);
+            Z_Free(lumpinfo[i].cache);
         }
     }