Fix some memory leaks

--HG--
branch : trunk
This commit is contained in:
silverice
2010-06-11 05:00:46 +03:00
parent d9d6e5732d
commit d6d9d50952
2 changed files with 10 additions and 10 deletions
@@ -1331,12 +1331,12 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
if ((*itr).Event.receive_emote.emoteId != text_emote) if ((*itr).Event.receive_emote.emoteId != text_emote)
return; return;
Condition* cond = new Condition(); Condition cond;
cond->mConditionType = ConditionType((*itr).Event.receive_emote.condition); cond.mConditionType = ConditionType((*itr).Event.receive_emote.condition);
cond->mConditionValue1 = (*itr).Event.receive_emote.conditionValue1; cond.mConditionValue1 = (*itr).Event.receive_emote.conditionValue1;
cond->mConditionValue2 = (*itr).Event.receive_emote.conditionValue2; cond.mConditionValue2 = (*itr).Event.receive_emote.conditionValue2;
if (cond->Meets(pPlayer)) if (cond.Meets(pPlayer))
{ {
sLog.outDebug("CreatureEventAI: ReceiveEmote CreatureEventAI: Condition ok, processing"); sLog.outDebug("CreatureEventAI: ReceiveEmote CreatureEventAI: Condition ok, processing");
ProcessEvent(*itr, pPlayer); ProcessEvent(*itr, pPlayer);
@@ -362,11 +362,11 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
} }
if (temp.receive_emote.condition) if (temp.receive_emote.condition)
{ {
Condition* cond = new Condition(); Condition cond;
cond->mConditionType = ConditionType(temp.receive_emote.condition); cond.mConditionType = ConditionType(temp.receive_emote.condition);
cond->mConditionValue1 = temp.receive_emote.conditionValue1; cond.mConditionValue1 = temp.receive_emote.conditionValue1;
cond->mConditionValue2 = temp.receive_emote.conditionValue2; cond.mConditionValue2 = temp.receive_emote.conditionValue2;
if (!sConditionMgr.isConditionTypeValid(cond)) if (!sConditionMgr.isConditionTypeValid(&cond))
{ {
sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.",temp.creature_id, i, temp.receive_emote.condition); sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.",temp.creature_id, i, temp.receive_emote.condition);
continue; continue;