aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2014-06-10 22:50:24 +0200
committerjackpoz <giacomopoz@gmail.com>2014-06-10 22:50:24 +0200
commitf19c6f4091406a42fd75f2cef73a2189cf856ba8 (patch)
tree6189e95ca35f0174dcce9d196c228a5fac947a26 /src
parent48f426abc545a209a4f3038bd4a4fc820f953d7f (diff)
Core/PetAI: Fix memory leak
Fix memory leak added in e7f0808d467210c2e0ca455cf810e52700518849 Valgrind log: 395,712 (390,216 direct, 5,496 indirect) bytes in 229 blocks are definitely lost in loss record 65 of 67 at operator new(unsigned long) (vg_replace_malloc.c:320) by PetAI::UpdateAI(unsigned int) (PetAI.cpp:167) by Creature::Update(unsigned int) (Creature.cpp:541) by TempSummon::Update(unsigned int) (TemporarySummon.cpp:47)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index 7c640f9a66d..8032568434f 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -183,7 +183,11 @@ void PetAI::UpdateAI(uint32 diff)
}
if (spellInfo->HasEffect(SPELL_EFFECT_JUMP_DEST))
+ {
+ if (!spellUsed)
+ delete spell;
continue; // Pets must only jump to target
+ }
// No enemy, check friendly
if (!spellUsed)