Use tmp variable for searchWad since envstr doesn't get changed

This commit is contained in:
indev committed 2024-05-30 19:32:18 +03:00
1 parent 040ddb1f40
commit 6269c7c827
1 file changed
+4 -3
+4 -3
View File
@@ -4042,13 +4042,14 @@ static const char *locateWad(void)
I_OutputMsg(",HOME/" DEFAULTDIR);
if ((envstr = I_GetEnv("HOME")) != NULL)
{
char *tmp = malloc(strlen(envstr) + sizeof(DEFAULTDIR));
char *tmp = malloc(strlen(envstr) + sizeof(PATHSEP) + sizeof(DEFAULTDIR));
strcpy(tmp, envstr);
strcat(tmp, PATHSEP);
strcat(tmp, DEFAULTDIR);
WadPath = searchWad(envstr);
WadPath = searchWad(tmp);
free(tmp);
if (WadPath)
return WadPath;
free(tmp);
}
#endif
#ifdef DEFAULTSEARCHPATH1