fix some G_BuildMapTitle memleaks

This commit is contained in:
Alug committed 2024-07-28 18:37:20 +02:00
1 parent fb622eda2a
commit e5159e13dd
3 files changed
+25 -6

No files matched your search

+4 -1
View File
@@ -3158,7 +3158,10 @@ static void Command_ReplayMarker(void)
demo.savemode = DSM_WILLAUTOSAVE;
if (adjustedleveltime < 0)
adjustedleveltime = 0;
snprintf(demo.titlename, 64, "%s [%i:%02d/%.5s]", G_BuildMapTitle(gamemap), G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername);
char *title = G_BuildMapTitle(gamemap);
snprintf(demo.titlename, 64, "%s [%i:%02d/%.5s]", title, G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername);
Z_Free(title);
CONS_Printf("Replay will be saved!\n");
}
}
+15 -3
View File
@@ -4621,8 +4621,14 @@ INT32 G_FindMap(const char *mapname, char **foundmapnamep,
for (i = 0, mapnum = 1; i < NUMMAPS; ++i, ++mapnum)
if (mapheaderinfo[i])
{
if (!( realmapname = G_BuildMapTitle(mapnum) ))
char *title = G_BuildMapTitle(mapnum);
if (!( realmapname = title ))
{
Z_Free(title);
continue;
}
Z_Free(title);
aprop = realmapname;
@@ -4694,7 +4700,9 @@ INT32 G_FindMap(const char *mapname, char **foundmapnamep,
}
if (newmapnum)
{
newmapname = G_BuildMapTitle(newmapnum);
char *title = G_BuildMapTitle(newmapnum);
newmapname = title;
Z_Free(title);
}
}
@@ -4784,7 +4792,11 @@ INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep)
return 0;
if (realmapnamep)
(*realmapnamep) = G_BuildMapTitle(newmapnum);
{
char *title = G_BuildMapTitle(newmapnum);
(*realmapnamep) = title;
Z_Free(title);
}
}
return newmapnum;
+6 -2
View File
@@ -2735,12 +2735,16 @@ static void HU_DrawRankings(void)
//V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, "Record Attack");
//else
//V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, gametype_cons_t[gametype].strvalue);
char *maptitle = G_BuildMapTitle(gamemap);
// draw the current map in the lower right if theres none just say its unknown
if (!G_BuildMapTitle(gamemap))
if (!maptitle)
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, "UNKNOWN");
else
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, G_BuildMapTitle(gamemap));
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, maptitle);
Z_Free(maptitle);
if (G_GametypeHasTeams())
{