From 9d01d090c48c74a29b4ef67e0cd204772a2193c3 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 24 Oct 2014 20:29:56 -0400 Subject: Replace strdup() with M_StringDuplicate(). strdup() can theoretically fail and return NULL. This could lead to a crash or undesirable behavior. Add M_StringDuplicate() which does the same thing but exits with an error if a string cannot be allocated. This fixes #456. Thanks to Quasar for the suggestion. --- src/doom/d_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/doom') diff --git a/src/doom/d_main.c b/src/doom/d_main.c index 10606161..1e9e950e 100644 --- a/src/doom/d_main.c +++ b/src/doom/d_main.c @@ -1123,7 +1123,7 @@ static void LoadIwadDeh(void) } else { - chex_deh = strdup("chex.deh"); + chex_deh = M_StringDuplicate("chex.deh"); } // If the dehacked patch isn't found, try searching the WAD -- cgit v1.2.3