Use M_StringJoin() instead of hand-rolled malloc.
This commit is contained in:
parent
b98b4e6be6
commit
4ae3076411
1 changed files with 6 additions and 9 deletions
15
src/d_iwad.c
15
src/d_iwad.c
|
|
@ -385,8 +385,7 @@ static void CheckSteamGUSPatches(void)
|
|||
{
|
||||
const char *current_path;
|
||||
char *install_path;
|
||||
char *patch_path;
|
||||
int len;
|
||||
char *test_patch_path, patch_path;
|
||||
|
||||
// Already configured? Don't stomp on the user's choices.
|
||||
current_path = M_GetStringVariable("gus_patch_path");
|
||||
|
|
@ -402,19 +401,17 @@ static void CheckSteamGUSPatches(void)
|
|||
return;
|
||||
}
|
||||
|
||||
len = strlen(install_path) + strlen(STEAM_BFG_GUS_PATCHES) + 20;
|
||||
patch_path = malloc(len);
|
||||
M_snprintf(patch_path, len, "%s\\%s\\ACBASS.PAT",
|
||||
install_path, STEAM_BFG_GUS_PATCHES);
|
||||
patch_path = M_StringJoin(install_path, "\\", STEAM_BFG_GUS_PATCHES,
|
||||
NULL);
|
||||
test_patch_path = M_StringJoin(patch_path, "\\ACBASS.PAT", NULL);
|
||||
|
||||
// Does acbass.pat exist? If so, then set gus_patch_path.
|
||||
if (M_FileExists(patch_path))
|
||||
if (M_FileExists(test_patch_path))
|
||||
{
|
||||
M_snprintf(patch_path, len, "%s\\%s",
|
||||
install_path, STEAM_BFG_GUS_PATCHES);
|
||||
M_SetVariable("gus_patch_path", patch_path);
|
||||
}
|
||||
|
||||
free(test_patch_path);
|
||||
free(patch_path);
|
||||
free(install_path);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue