diff options
author | Simon Howard | 2014-10-24 20:29:56 -0400 |
---|---|---|
committer | Simon Howard | 2014-10-24 20:29:56 -0400 |
commit | 9d01d090c48c74a29b4ef67e0cd204772a2193c3 (patch) | |
tree | 3a8dce09c81c6cd9db8adf266d5cc6eae366af98 /src/setup/sound.c | |
parent | b42b5269e0ad5b22acd6043429ec4013a4e76ddd (diff) | |
download | chocolate-doom-9d01d090c48c74a29b4ef67e0cd204772a2193c3.tar.gz chocolate-doom-9d01d090c48c74a29b4ef67e0cd204772a2193c3.tar.bz2 chocolate-doom-9d01d090c48c74a29b4ef67e0cd204772a2193c3.zip |
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.
Diffstat (limited to 'src/setup/sound.c')
-rw-r--r-- | src/setup/sound.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/setup/sound.c b/src/setup/sound.c index 76fc0564..2b9bfcbb 100644 --- a/src/setup/sound.c +++ b/src/setup/sound.c @@ -20,6 +20,7 @@ #include "textscreen.h" #include "m_config.h" +#include "m_misc.h" #include "mode.h" #include "sound.h" @@ -324,8 +325,8 @@ void BindSoundVariables(void) M_BindVariable("show_talk", &show_talk); } - timidity_cfg_path = strdup(""); - gus_patch_path = strdup(""); + timidity_cfg_path = M_StringDuplicate(""); + gus_patch_path = M_StringDuplicate(""); // Default sound volumes - different games use different values. |