foxygit / doom Log in
commit 263a6fef37d9b6151ead74ed499cb2972877951b
Author:     Turo Lamminen <turol@iki.fi>
AuthorDate: Tue Feb 4 13:10:20 2020 +0200
Commit:     Turo Lamminen <turol@iki.fi>
CommitDate: Fri Mar 20 16:55:29 2020 +0200

    doom: Allocate deh_gamename with standard malloc
---
 src/doom/d_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index 5b4bc373..70cfad8a 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -695,7 +695,11 @@ static char *GetGameName(char *gamename)
             // We also need to cut off spaces to get the basic name

             gamename_size = strlen(deh_sub) + 10;
-            deh_gamename = Z_Malloc(gamename_size, PU_STATIC, 0);
+            deh_gamename = malloc(gamename_size);
+            if (deh_gamename == NULL)
+            {
+                I_Error("GetGameName: Failed to allocate new string");
+            }
             version = G_VanillaVersionCode();
             M_snprintf(deh_gamename, gamename_size, deh_sub,
                        version / 100, version % 100);