delet all the Z_Free checks
Z_Free already checks its input internally!
This commit is contained in:
parent
557166ccef
commit
5d1f03b77f
15 changed files with 34 additions and 77 deletions
|
|
@ -1811,9 +1811,7 @@ void F_StartWaitingPlayers(void)
|
|||
#ifdef NOWAY
|
||||
randskin = M_RandomKey(numskins);
|
||||
|
||||
if (waitcolormap)
|
||||
Z_Free(waitcolormap);
|
||||
|
||||
Z_Free(waitcolormap);
|
||||
waitcolormap = R_GetTranslationColormap(randskin, skins[randskin].prefcolor, 0);
|
||||
|
||||
sprdef = &skins[randskin].sprites[P_GetSkinSprite2(&skins[randskin], SPR2_FSTN, NULL)];
|
||||
|
|
|
|||
|
|
@ -283,8 +283,7 @@ void closefilemenu(boolean validsize)
|
|||
coredirmenu = NULL;
|
||||
}
|
||||
|
||||
if (refreshdirname)
|
||||
Z_Free(refreshdirname);
|
||||
Z_Free(refreshdirname);
|
||||
refreshdirname = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -312,8 +311,7 @@ void searchfilemenu(char *tempname)
|
|||
|
||||
if (!menusearch.length)
|
||||
{
|
||||
if (dirmenu)
|
||||
Z_Free(dirmenu);
|
||||
Z_Free(dirmenu);
|
||||
dirmenu = coredirmenu;
|
||||
sizedirmenu = sizecoredirmenu;
|
||||
|
||||
|
|
@ -355,8 +353,8 @@ void searchfilemenu(char *tempname)
|
|||
I_Error("searchfilemenu(): could not create \"No results...\".");
|
||||
sizedirmenu = 1;
|
||||
dir_on[menudepthleft] = 0;
|
||||
if (tempname)
|
||||
Z_Free(tempname);
|
||||
Z_Free(tempname);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -480,8 +478,8 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
|||
{
|
||||
closedir(dirhandle);
|
||||
closefilemenu(false);
|
||||
if (tempname)
|
||||
Z_Free(tempname);
|
||||
Z_Free(tempname);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -916,8 +916,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
|||
if ((cv_chatnotifications.value) && (flags & HU_SHOUT))
|
||||
S_StartSound(NULL, sfx_sysmsg);
|
||||
|
||||
if (tempchar)
|
||||
Z_Free(tempchar);
|
||||
Z_Free(tempchar);
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
// I just want to point out while I'm here that because the data is still
|
||||
|
|
@ -1418,9 +1417,7 @@ static void HU_drawMiniChat(void)
|
|||
dy = 0;
|
||||
dx = 0;
|
||||
msglines += linescount+1;
|
||||
|
||||
if (msg)
|
||||
Z_Free(msg);
|
||||
Z_Free(msg);
|
||||
}
|
||||
|
||||
y = chaty - charheight*(msglines+1);
|
||||
|
|
@ -1509,9 +1506,7 @@ static void HU_drawMiniChat(void)
|
|||
|
||||
dy += charheight;
|
||||
dx = 0;
|
||||
|
||||
if (msg)
|
||||
Z_Free(msg);
|
||||
Z_Free(msg);
|
||||
}
|
||||
|
||||
// decrement addy and make that shit smooth:
|
||||
|
|
@ -1622,9 +1617,7 @@ static void HU_drawChatLog(INT32 offset)
|
|||
|
||||
dy += charheight;
|
||||
dx = 0;
|
||||
|
||||
if (msg)
|
||||
Z_Free(msg);
|
||||
Z_Free(msg);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
14
src/i_tcp.c
14
src/i_tcp.c
|
|
@ -1550,11 +1550,8 @@ static boolean SOCK_SetBanUsername(const char *username)
|
|||
username = "Direct IP ban";
|
||||
}
|
||||
|
||||
if (banned[numbans - 1].username)
|
||||
{
|
||||
Z_Free(banned[numbans - 1].username);
|
||||
banned[numbans - 1].username = NULL;
|
||||
}
|
||||
Z_Free(banned[numbans - 1].username);
|
||||
banned[numbans - 1].username = NULL;
|
||||
|
||||
banned[numbans - 1].username = Z_StrDup(username);
|
||||
return true;
|
||||
|
|
@ -1567,11 +1564,8 @@ static boolean SOCK_SetBanReason(const char *reason)
|
|||
reason = "No reason given";
|
||||
}
|
||||
|
||||
if (banned[numbans - 1].reason)
|
||||
{
|
||||
Z_Free(banned[numbans - 1].reason);
|
||||
banned[numbans - 1].reason = NULL;
|
||||
}
|
||||
Z_Free(banned[numbans - 1].reason);
|
||||
banned[numbans - 1].reason = NULL;
|
||||
|
||||
banned[numbans - 1].reason = Z_StrDup(reason);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -107,8 +107,7 @@ void K_EraseStats(void)
|
|||
// The only field we want to remember
|
||||
boolean vanilla = kartstats.vanilla;
|
||||
|
||||
if (kartstats.copy)
|
||||
Z_Free(kartstats.copy);
|
||||
Z_Free(kartstats.copy);
|
||||
|
||||
memset(&kartstats, 0, sizeof(kartstats_t));
|
||||
|
||||
|
|
|
|||
|
|
@ -143,18 +143,9 @@ void LUA_HUD_DestroyDrawList(huddrawlist_h list)
|
|||
{
|
||||
if (list == NULL) return;
|
||||
|
||||
if (list->items)
|
||||
{
|
||||
Z_Free(list->items);
|
||||
}
|
||||
if (list->olditems)
|
||||
{
|
||||
Z_Free(list->olditems);
|
||||
}
|
||||
if (list->strbuf)
|
||||
{
|
||||
Z_Free(list->strbuf);
|
||||
}
|
||||
Z_Free(list->items);
|
||||
Z_Free(list->olditems);
|
||||
Z_Free(list->strbuf);
|
||||
Z_Free(list);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -745,16 +745,13 @@ INT32 GIF_close(void)
|
|||
fclose(gif_out);
|
||||
gif_out = NULL;
|
||||
|
||||
if (gifbwr_buf)
|
||||
Z_Free(gifbwr_buf);
|
||||
Z_Free(gifbwr_buf);
|
||||
gifbwr_buf = gifbwr_cur = NULL;
|
||||
|
||||
if (gifframe_data)
|
||||
Z_Free(gifframe_data);
|
||||
Z_Free(gifframe_data);
|
||||
gifframe_data = NULL;
|
||||
|
||||
if (giflzw_hashTable)
|
||||
Z_Free(giflzw_hashTable);
|
||||
Z_Free(giflzw_hashTable);
|
||||
giflzw_hashTable = NULL;
|
||||
|
||||
Z_Free(scrbuf_screens);
|
||||
|
|
|
|||
|
|
@ -67,12 +67,9 @@ void M_AddRawCondition(UINT8 set, UINT8 id, conditiontype_t c, INT32 r, INT16 x1
|
|||
|
||||
void M_ClearConditionSet(UINT8 set)
|
||||
{
|
||||
if (conditionSets[set - 1].numconditions)
|
||||
{
|
||||
Z_Free(conditionSets[set - 1].condition);
|
||||
conditionSets[set - 1].condition = NULL;
|
||||
conditionSets[set - 1].numconditions = 0;
|
||||
}
|
||||
Z_Free(conditionSets[set - 1].condition);
|
||||
conditionSets[set - 1].condition = NULL;
|
||||
conditionSets[set - 1].numconditions = 0;
|
||||
conditionSets[set - 1].achieved = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8076,8 +8076,7 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
|
||||
// Allocate each list
|
||||
for (i = 0; i < numsectors; i++)
|
||||
if(secthinkers[i].thinkers)
|
||||
Z_Free(secthinkers[i].thinkers);
|
||||
Z_Free(secthinkers[i].thinkers);
|
||||
|
||||
Z_Free(secthinkers);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1025,13 +1025,9 @@ void R_ExecuteSetViewSize(void)
|
|||
// planes
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
if (ds_su)
|
||||
Z_Free(ds_su);
|
||||
if (ds_sv)
|
||||
Z_Free(ds_sv);
|
||||
if (ds_sz)
|
||||
Z_Free(ds_sz);
|
||||
|
||||
Z_Free(ds_su);
|
||||
Z_Free(ds_sv);
|
||||
Z_Free(ds_sz);
|
||||
ds_su = ds_sv = ds_sz = NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1977,8 +1977,7 @@ static void PaletteTextureHack(const char **name)
|
|||
|
||||
void R_ClearTextureNumCache(boolean btell)
|
||||
{
|
||||
if (tidcache)
|
||||
Z_Free(tidcache);
|
||||
Z_Free(tidcache);
|
||||
tidcache = NULL;
|
||||
if (btell)
|
||||
CONS_Debug(DBG_SETUP, "Fun Fact: There are %d textures used in this map.\n", tidcachelen);
|
||||
|
|
|
|||
|
|
@ -3922,9 +3922,7 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
|||
// Make sure table is built
|
||||
if (heatshifter == NULL || lastheight != viewheight)
|
||||
{
|
||||
if (heatshifter)
|
||||
Z_Free(heatshifter);
|
||||
|
||||
Z_Free(heatshifter);
|
||||
heatshifter = Z_Calloc(viewheight * sizeof(boolean), PU_STATIC, NULL);
|
||||
|
||||
for (y = 0; y < viewheight; y++)
|
||||
|
|
|
|||
|
|
@ -2801,10 +2801,7 @@ void vres_Free(virtres_t* vres)
|
|||
|
||||
while (vres->numlumps--)
|
||||
{
|
||||
if (vres->vlumps[vres->numlumps].data)
|
||||
{
|
||||
Z_Free(vres->vlumps[vres->numlumps].data);
|
||||
}
|
||||
Z_Free(vres->vlumps[vres->numlumps].data);
|
||||
}
|
||||
Z_Free(vres->vlumps);
|
||||
Z_Free(vres);
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ void Z_Init(void)
|
|||
*
|
||||
* \param ptr A pointer to allocated memory,
|
||||
* assumed to have been allocated with Z_Malloc/Z_Calloc.
|
||||
* These free functions also automatically check for NULL!
|
||||
* \sa Z_FreeTags
|
||||
*/
|
||||
void Z_Free2(void *ptr, const char *file, INT32 line)
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ void Z_Init(void);
|
|||
// Zone memory allocation
|
||||
//
|
||||
|
||||
// Z_Free and alloc with alignment
|
||||
// Z_Free and alloc with alignment, automatically checks for NULL.
|
||||
#define Z_Free(p) Z_Free2(p, __FILE__, __LINE__)
|
||||
#define Z_MallocAlign(s,t,u,a) Z_Malloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
#define Z_CallocAlign(s,t,u,a) Z_Calloc2(s, t, u, a, __FILE__, __LINE__)
|
||||
|
|
|
|||
Loading…
Reference in a new issue