From 71d8ef248f4f1a05646f5e1e7e6388a59f08b121 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 30 Mar 2014 18:07:52 -0400 Subject: Eliminate some uses of sprintf() from common code. As part of this, add DIR_SEPARATOR_S as a string version of the DIR_SEPARATOR macro. Change M_TempFile() to return a string allocated on the C heap rather than the zone heap. This is a first step towards fixing #371. --- src/i_sdlmusic.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/i_sdlmusic.c') diff --git a/src/i_sdlmusic.c b/src/i_sdlmusic.c index fd5aa006..50a7bbbf 100644 --- a/src/i_sdlmusic.c +++ b/src/i_sdlmusic.c @@ -116,13 +116,12 @@ void I_InitTimidityConfig(void) if (success) { - env_string = malloc(strlen(temp_timidity_cfg) + 15); - sprintf(env_string, "TIMIDITY_CFG=%s", temp_timidity_cfg); + env_string = M_StringJoin("TIMIDITY_CFG=", temp_timidity_cfg, NULL); putenv(env_string); } else { - Z_Free(temp_timidity_cfg); + free(temp_timidity_cfg); temp_timidity_cfg = NULL; } } @@ -426,7 +425,7 @@ static void *I_SDL_RegisterSong(void *data, int len) remove(filename); } - Z_Free(filename); + free(filename); return music; } -- cgit v1.2.3