From f19c6f4091406a42fd75f2cef73a2189cf856ba8 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Tue, 10 Jun 2014 22:50:24 +0200 Subject: 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) --- src/server/game/AI/CoreAI/PetAI.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') 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) -- cgit v1.2.3