Scripts: Fix two issues found by Valgrind

==3400== Invalid write of size 8
==3400==    at 0x1241C32: instance_ahnkahet::GetInstanceScript(InstanceMap*) const (instance_ahnkahet.cpp:54)
...
==3400== Conditional jump or move depends on uninitialised value(s)
==3400==    at 0xB5DEAE: std::tr1::_Hashtable<unsigned long, std::pair<unsigned long const, Creature*>, std::allocator<std::pair<unsigned long const, Creature*> >, std::_Select1st<std::pair<unsigned long const, Creature*> >, std::equal_to<unsigned long>, std::tr1::hash<unsigned long>, std::tr1::__detail::_Mod_range_hashing, std::tr1::__detail::_Default_ranged_hash, std::tr1::__detail::_Prime_rehash_policy, false, false, true>::_M_find_node(std::tr1::__detail::_Hash_node<std::pair<unsigned long const, Creature*>, false>*, unsigned long const&, unsigned long) const (hashtable.h:830)
==3400==    by 0xBDA4CA: std::tr1::_Hashtable<unsigned long, std::pair<unsigned long const, Creature*>, std::allocator<std::pair<unsigned long const, Creature*> >, std::_Select1st<std::pair<unsigned long const, Creature*> >, std::equal_to<unsigned long>, std::tr1::hash<unsigned long>, std::tr1::__detail::_Mod_range_hashing, std::tr1::__detail::_Default_ranged_hash, std::tr1::__detail::_Prime_rehash_policy, false, false, true>::find(unsigned long const&) (hashtable.h:698)
==3400==    by 0xBDA5BF: HashMapHolder<Creature>::Find(unsigned long) (ObjectAccessor.h:67)
==3400==    by 0xCB5C03: Map::GetCreature(unsigned long) (ObjectAccessor.h:114)
==3400==    by 0xB6E6EF: Unit::GetCreature(WorldObject&, unsigned long) (Unit.cpp:13023)
==3400==    by 0x10F0790: boss_hydross_the_unstable::boss_hydross_the_unstableAI::Reset() (boss_hydross_the_unstable.cpp:164)
This commit is contained in:
Nay committed 2013-08-24 01:54:37 +01:00
1 parent 556c478e68
commit a0a377a0ce
2 files changed
+7 -5

No files matched your search

@@ -49,9 +49,10 @@ class instance_ahnkahet : public InstanceMapScript
JedogaTarget = 0;
SwitchTrigger = 0;
InitiandGUIDs.clear();
SpheresState[0] = 0;
SpheresState[1] = 0;
memset(SpheresState, 0, 2 * sizeof(uint64));
InitiandGUIDs.clear();
}
void OnCreatureCreate(Creature* creature) OVERRIDE
@@ -94,6 +94,8 @@ public:
boss_hydross_the_unstableAI(Creature* creature) : ScriptedAI(creature), Summons(me)
{
instance = creature->GetInstanceScript();
beams[0] = 0;
beams[1] = 0;
}
InstanceScript* instance;
@@ -159,10 +161,9 @@ public:
}
void DeSummonBeams()
{
for (uint8 i=0; i<2; ++i)
for (uint8 i = 0; i < 2; ++i)
{
Creature* mob = Unit::GetCreature(*me, beams[i]);
if (mob)
if (Creature* mob = Unit::GetCreature(*me, beams[i]))
{
mob->setDeathState(DEAD);
mob->RemoveCorpse();