shithub: choc

Download patch

ref: 482d302ee846fb30d23d50ccff8549d300a81b75
parent: 1b98fb58714e590638c35fc7df9e1e587b4ed3d3
parent: b18f4641c3043d097038a8e391687a8735197898
author: Fabian Greffrath <fabian@greffrath.com>
date: Wed Dec 12 16:00:56 EST 2018

Merge pull request #1119 from mfrancis95/master

Fix memory leak in Strife related to finding voices.wad and make finding it case-insensitive

--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -855,10 +855,8 @@
             voiceswad = M_SafeFilePath(iwadpath, "voices.wad");
             Z_Free(iwadpath);
 
-            if(!M_FileExists(voiceswad))
-                Z_Free(voiceswad);
-            else
-                name = voiceswad; // STRIFE-FIXME: memory leak!!
+            name = M_FileCaseExists(voiceswad);
+            Z_Free(voiceswad);
         }
 
         // not found? try global search paths
@@ -877,6 +875,7 @@
         {
             // add it.
             D_AddFile(name);
+            free(name);
         }
     }
 }