From 36d336e69cd60d0d111c78a37711581adbc02067 Mon Sep 17 00:00:00 2001 From: Michael Cook Date: Thu, 24 Oct 2013 17:35:21 -0400 Subject: [PATCH] Fix some memory leaks in Mob::SpellOnTarget This should fix the memory leak introduced in the last commit and a few lingering memory leaks, don't think they should break anything --- changelog.txt | 3 +++ zone/spells.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/changelog.txt b/changelog.txt index abf75bb1f..9d4a872e7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/24/2013 == +demonstar55: Fix some memory leaks in Mob::SpellOnTarget + == 10/21/2013 == demonstar55: Changed GetMinLevel return 0 for more cases that EQ uses for some reason ... demonstar55: Added buff level restrictions, set the Spells:BuffLevelRestrictions to false to have the old behavior. diff --git a/zone/spells.cpp b/zone/spells.cpp index 3b7f391f3..12c047c6c 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -3287,6 +3287,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r spelltar->GetBodyType() != BT_Undead && spelltar->GetBodyType() != BT_Vampire) { + safe_delete(action_packet); return false; } } @@ -3300,6 +3301,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if(focus) { CheckHitsRemaining(b); Message_StringID(MT_Shout, SPELL_WOULDNT_HOLD); + safe_delete(action_packet); return false; } } @@ -3347,6 +3349,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r if(reflect_chance) { Message_StringID(MT_Spells, SPELL_REFLECT, GetCleanName(), spelltar->GetCleanName()); SpellOnTarget(spell_id, this, true, use_resist_adjust, resist_adjust); + safe_delete(action_packet); return false; } } @@ -3520,6 +3523,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r mlog(SPELLS__BUFFS, "Spell %d failed: recipient did not meet the level restrictions", spell_id); if(!IsBardSong(spell_id)) Message_StringID(MT_SpellFailure, SPELL_TOO_POWERFUL); + safe_delete(action_packet); return false; }