Proper initialize POD struct members to 0 in SMART_ACTION_CREATE_TIMED_EVENT action type.
Fix array overflows and access uninitialized values in SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST, SMART_ACTION_RANDOM_PHASE and SMART_ACTION_RANDOM_EMOTE .
Valgrind log for SMART_ACTION_RANDOM_PHASE case:
Conditional jump or move depends on uninitialised value(s)
at : SmartScript::UpdateTimer(SmartScriptHolder&, unsigned int) (SmartScript.cpp:3086)
by : SmartScript::OnUpdate(unsigned int) (SmartScript.cpp:3176)
by : SmartAI::UpdateAI(unsigned int) (SmartAI.cpp:335)
by : Creature::Update(unsigned int) (Creature.cpp:542)
by : TempSummon::Update(unsigned int) (TemporarySummon.cpp:47)
Uninitialised value was created by a stack allocation
at : SmartScript::ProcessAction(SmartScriptHolder&, Unit*, unsigned int, unsigned int, bool, SpellInfo const*, GameObject*) (SmartScript.cpp:143)
Reset() has if checks on values that are initialized after them so it's required to initialize these fields in the constructor.
Valgrind log:
Conditional jump or move depends on uninitialised value(s)
by 0x11CF472: HashMapHolder<Creature>::Find(unsigned long) (ObjectAccessor.h:67)
by 0x11CE36F: Creature* ObjectAccessor::GetObjectInWorld<Creature>(unsigned long, Creature*) (ObjectAccessor.h:114)
by 0x1257C13: Creature* ObjectAccessor::GetObjectInMap<Creature>(unsigned long, Map*, Creature*) (ObjectAccessor.h:135)
by 0x12E64F1: Map::GetCreature(unsigned long) (Map.cpp:2767)
by 0x10AF4DE: Unit::GetCreature(WorldObject&, unsigned long) (Unit.cpp:13021)
by 0x16F8F81: npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::Reset() (chapter5.cpp:386)
by 0x16F8D36: npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::npc_highlord_darion_mograineAI(Creature*) (chapter5.cpp:314)
by 0x16F8CD6: npc_highlord_darion_mograine::GetAI(Creature*) const (chapter5.cpp:307)
by 0x132AF6C: ScriptMgr::GetCreatureAI(Creature*) (ScriptMgr.cpp:796)
by 0x1441D45: FactorySelector::selectAI(Creature*) (CreatureAISelector.cpp:41)
Change DatabaseWorkerPool<T>::DirectExecute() to handle PreparedStatement disposal in the same way of DatabaseWorkerPool<T>::Query() , thanks Joschiwald for patch.
Fix .account create command not deleting a MySql PreparedStatement .
Valgrind log:
254 (40 direct, 214 indirect) bytes in 1 blocks are definitely lost in loss record 6 of 8
at 0x4C24DFA: operator new(unsigned long) (vg_replace_malloc.c:261)
by 0x998EC2: DatabaseWorkerPool<LoginDatabaseConnection>::GetPreparedStatement(unsigned int) (DatabaseWorkerPool.h:437)
by 0x99599B: AccountMgr::CreateAccount(std::string, std::string, std::string) (AccountMgr.cpp:49)
by 0xF3ABAC: account_commandscript::HandleAccountCreateCommand(ChatHandler*, char const*)
Fix conditional jump on uninitialized value in PathGenerator::GetNavTerrain() by checking the result of getLiquidStatus() before accessing the LiquidData, uninitialized in case there's no water at all.
Valgrind log:
Conditional jump or move depends on uninitialised value(s)
at : PathGenerator::GetNavTerrain(float, float, float) (PathGenerator.cpp:553)
by : PathGenerator::UpdateFilter() (PathGenerator.cpp:542)
by : PathGenerator::CreateFilter() (PathGenerator.cpp:530)
by : PathGenerator::PathGenerator(Unit const*) (PathGenerator.cpp:46)
by : Spell::Spell(Unit*, SpellInfo const*, TriggerCastFlags, unsigned long, bool) (Spell.cpp:493)
by : Unit::CastSpell(SpellCastTargets const&, SpellInfo const*, CustomSpellValues const*, TriggerCastFlags, Item*, AuraEffect const*, unsigned long) (Unit.cpp:846)
by : Unit::CastSpell(Unit*, SpellInfo const*, TriggerCastFlags, Item*, AuraEffect const*, unsigned long) (Unit.cpp:882)
by : Unit::CastSpell(Unit*, unsigned int, TriggerCastFlags, Item*, AuraEffect const*, unsigned long) (Unit.cpp:870)
by : Unit::CastSpell(Unit*, unsigned int, bool, Item*, AuraEffect const*, unsigned long) (Unit.cpp:858)
by : Player::SendInitialPacketsAfterAddToMap() (Player.cpp:22580)
by : WorldSession::HandleMoveWorldportAckOpcode() (MovementHandler.cpp:121)
by : WorldSession::HandleMoveWorldportAckOpcode(WorldPacket&) (MovementHandler.cpp:37)
Fixes#8377
Consists of:
1) Battle at Valhalas: Fallen Heroes (13214)
2) Battle at Valhalas: Khit'rix the Dark Master (13215)
3) Battle at Valhalas: The Return of Sigrid Iceborn (13216)
4) Battle at Valhalas: Carnage! (13217)
5) Battle at Valhalas: Thane Deathblow (13218)
6) Battle at Valhalas: Final Challenge (13219)
Restore 2 disabled warnings, 1 already disabled in CMake with the WITH_WARNINGS flag set to False and the other disabled by default as stated in VS documentation http://msdn.microsoft.com/en-us/library/aa984150.aspx