plug a potential memory leak in M_SaveConfig
This commit is contained in:
parent
8e025b97c2
commit
0648916c4a
2 changed files with 13 additions and 6 deletions
|
|
@ -1332,6 +1332,7 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
|||
x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return newstring;
|
||||
}
|
||||
|
||||
|
|
@ -1402,14 +1403,17 @@ static void HU_drawMiniChat(void)
|
|||
{
|
||||
j++;
|
||||
}
|
||||
|
||||
prev_linereturn = false;
|
||||
dx += charwidth;
|
||||
|
||||
if (dx >= boxw)
|
||||
{
|
||||
dx = 0;
|
||||
linescount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
dy = 0;
|
||||
dx = 0;
|
||||
msglines += linescount+1;
|
||||
|
|
@ -1494,12 +1498,14 @@ static void HU_drawMiniChat(void)
|
|||
|
||||
dx += charwidth;
|
||||
prev_linereturn = false;
|
||||
|
||||
if (dx >= boxw)
|
||||
{
|
||||
dx = 0;
|
||||
dy += charheight;
|
||||
}
|
||||
}
|
||||
|
||||
dy += charheight;
|
||||
dx = 0;
|
||||
|
||||
|
|
@ -1612,6 +1618,7 @@ static void HU_drawChatLog(INT32 offset)
|
|||
dy += charheight;
|
||||
}
|
||||
}
|
||||
|
||||
dy += charheight;
|
||||
dx = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -602,7 +602,7 @@ void M_FirstLoadConfig(void)
|
|||
void M_SaveConfig(const char *filename)
|
||||
{
|
||||
FILE *f;
|
||||
char *filepath;
|
||||
CLEANUP(Z_Pfree) char *filepath = NULL;
|
||||
char backupfile[MAX_WADPATH+4];
|
||||
|
||||
// make sure not to write back the config until it's been correctly loaded
|
||||
|
|
@ -637,7 +637,7 @@ void M_SaveConfig(const char *filename)
|
|||
// append srb2home to beginning of filename
|
||||
// but check if srb2home isn't already there, first
|
||||
if (!strstr(filename, srb2home))
|
||||
filepath = va(pandf,srb2home, filename);
|
||||
filepath = Z_StrDup(va(pandf, srb2home, filename));
|
||||
else
|
||||
filepath = Z_StrDup(filename);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue