Use the FREE_AND_SET_NULL macro where appropriate
This commit is contained in:
@@ -594,8 +594,7 @@ static void StatsChangeAnimation_Step3(u8 taskId)
|
|||||||
if (gTasks[taskId].data[6] == 1)
|
if (gTasks[taskId].data[6] == 1)
|
||||||
gSprites[gTasks[taskId].data[7]].oam.priority++;
|
gSprites[gTasks[taskId].data[7]].oam.priority++;
|
||||||
|
|
||||||
Free(sAnimStatsChangeData);
|
FREE_AND_SET_NULL(sAnimStatsChangeData);
|
||||||
sAnimStatsChangeData = NULL;
|
|
||||||
DestroyAnimVisualTask(taskId);
|
DestroyAnimVisualTask(taskId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-6
@@ -1498,8 +1498,7 @@ static void CB2_PreInitMultiBattle(void)
|
|||||||
gBattleTypeFlags = *savedBattleTypeFlags;
|
gBattleTypeFlags = *savedBattleTypeFlags;
|
||||||
gMain.savedCallback = *savedCallback;
|
gMain.savedCallback = *savedCallback;
|
||||||
SetMainCallback2(CB2_InitBattleInternal);
|
SetMainCallback2(CB2_InitBattleInternal);
|
||||||
Free(sMultiPartnerPartyBuffer);
|
FREE_AND_SET_NULL(sMultiPartnerPartyBuffer);
|
||||||
sMultiPartnerPartyBuffer = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (gReceivedRemoteLinkPlayers == 0)
|
else if (gReceivedRemoteLinkPlayers == 0)
|
||||||
@@ -1507,8 +1506,7 @@ static void CB2_PreInitMultiBattle(void)
|
|||||||
gBattleTypeFlags = *savedBattleTypeFlags;
|
gBattleTypeFlags = *savedBattleTypeFlags;
|
||||||
gMain.savedCallback = *savedCallback;
|
gMain.savedCallback = *savedCallback;
|
||||||
SetMainCallback2(CB2_InitBattleInternal);
|
SetMainCallback2(CB2_InitBattleInternal);
|
||||||
Free(sMultiPartnerPartyBuffer);
|
FREE_AND_SET_NULL(sMultiPartnerPartyBuffer);
|
||||||
sMultiPartnerPartyBuffer = NULL;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1544,8 +1542,7 @@ static void CB2_PreInitIngamePlayerPartnerBattle(void)
|
|||||||
gBattleTypeFlags = *savedBattleTypeFlags;
|
gBattleTypeFlags = *savedBattleTypeFlags;
|
||||||
gMain.savedCallback = *savedCallback;
|
gMain.savedCallback = *savedCallback;
|
||||||
SetMainCallback2(CB2_InitBattleInternal);
|
SetMainCallback2(CB2_InitBattleInternal);
|
||||||
Free(sMultiPartnerPartyBuffer);
|
FREE_AND_SET_NULL(sMultiPartnerPartyBuffer);
|
||||||
sMultiPartnerPartyBuffer = NULL;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -816,8 +816,7 @@ static void Task_EvolutionScene(u8 taskId)
|
|||||||
|
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
FreeMonSpritesGfx();
|
FreeMonSpritesGfx();
|
||||||
Free(sEvoStructPtr);
|
FREE_AND_SET_NULL(sEvoStructPtr);
|
||||||
sEvoStructPtr = NULL;
|
|
||||||
FreeAllWindowBuffers();
|
FreeAllWindowBuffers();
|
||||||
SetMainCallback2(gCB2_AfterEvolution);
|
SetMainCallback2(gCB2_AfterEvolution);
|
||||||
}
|
}
|
||||||
@@ -1223,8 +1222,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
|
|||||||
if (!IsTextPrinterActive(0))
|
if (!IsTextPrinterActive(0))
|
||||||
{
|
{
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
Free(sEvoStructPtr);
|
FREE_AND_SET_NULL(sEvoStructPtr);
|
||||||
sEvoStructPtr = NULL;
|
|
||||||
gTextFlags.useAlternateDownArrow = 0;
|
gTextFlags.useAlternateDownArrow = 0;
|
||||||
SetMainCallback2(gCB2_AfterEvolution);
|
SetMainCallback2(gCB2_AfterEvolution);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ u32 MysteryGiftClient_Run(u16 * endVal)
|
|||||||
{
|
{
|
||||||
*endVal = sClient->param;
|
*endVal = sClient->param;
|
||||||
MysteryGiftClient_Free(sClient);
|
MysteryGiftClient_Free(sClient);
|
||||||
Free(sClient);
|
FREE_AND_SET_NULL(sClient);
|
||||||
sClient = NULL;
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ u32 MysterGiftServer_Run(u16 * endVal)
|
|||||||
{
|
{
|
||||||
*endVal = sServer->param;
|
*endVal = sServer->param;
|
||||||
MysteryGiftServer_Free(sServer);
|
MysteryGiftServer_Free(sServer);
|
||||||
Free(sServer);
|
FREE_AND_SET_NULL(sServer);
|
||||||
sServer = NULL;
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,8 +207,7 @@ void WonderCard_Destroy(void)
|
|||||||
if (sWonderCardData != NULL)
|
if (sWonderCardData != NULL)
|
||||||
{
|
{
|
||||||
*sWonderCardData = (struct WonderCardData){};
|
*sWonderCardData = (struct WonderCardData){};
|
||||||
Free(sWonderCardData);
|
FREE_AND_SET_NULL(sWonderCardData);
|
||||||
sWonderCardData = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -660,8 +659,7 @@ void WonderNews_Destroy(void)
|
|||||||
if (sWonderNewsData != NULL)
|
if (sWonderNewsData != NULL)
|
||||||
{
|
{
|
||||||
*sWonderNewsData = (struct WonderNewsData){};
|
*sWonderNewsData = (struct WonderNewsData){};
|
||||||
Free(sWonderNewsData);
|
FREE_AND_SET_NULL(sWonderNewsData);
|
||||||
sWonderNewsData = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user