foxygit / doom Log in
commit 6a500c42694e05d7c849fecdf2c9cd705ed3c1ae
Author:     Turo Lamminen <turotl@gmail.com>
AuthorDate: Sat Jul 21 16:20:37 2018 +0300
Commit:     Turo Lamminen <turotl@gmail.com>
CommitDate: Sat Jul 21 16:27:31 2018 +0300

    d_iwad: One path through D_TryFindWADByName creates a new string so all paths must

    Otherwise the caller won't know whether it should free the string
---
 src/d_iwad.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/d_iwad.c b/src/d_iwad.c
index 3b088616..93943eec 100644
--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@ -773,7 +773,7 @@ char *D_FindWADByName(const char *name)
 //
 // D_TryWADByName
 //
-// Searches for a WAD by its filename, or passes through the filename
+// Searches for a WAD by its filename, or returns a copy of the filename
 // if not found.
 //

@@ -789,7 +789,7 @@ char *D_TryFindWADByName(char *filename)
     }
     else
     {
-        return filename;
+        return M_StringDuplicate(filename);
     }
 }