foxygit / doom Log in
commit c878d6bc494457a2ca70f171a60d2ec5b85a9987
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Sun Aug 16 18:18:16 2015 -0400
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Sun Aug 16 18:18:16 2015 -0400

    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.
---
 src/w_wad.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/w_wad.c b/src/w_wad.c
index a8a952b6..ea684f4e 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -612,12 +612,12 @@ void W_Reload(void)
         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);
         }
     }