DB/Conditions: Awakening Rod
Fix uninitialized UpdateMask field

Initialized UpdateMask::_bits to NULL in all constructors.
UpdateMask(UpdateMask const& right) constructor sets the field count with SetCount() method before any field initialization. This means that SetCount() will call delete[] on the uninitialized _bits pointer field, leading to undefined behavior.
DB/SAI: The Last of Her Kind credit update

By @untaught, fixes #10254
Merge pull request #10617 from jackpoz/updatemask_fix

Fix uninitialized UpdateMask field
DB/SAI: Cannot Reproduce (13320,13355) & Retest Now (13321,13322,13356,13357)
Core&Tools: Fix multiple issues found by a static code coverage tool
DB/Creature: Fix startup errors
Core/Threading: Fix race condition in Thread

Increment the reference count of m_task in Thread::start() before spawning the actual Thread that will execute the task, otherwise the thread might finish, decRef the task and delete it.

Valgrind log of the issue:
 Invalid read of size 8
   at 0x1314CAD: ACE_Atomic_Op_GCC<long>::operator++() (Atomic_Op_GCC_T.inl:34)
   by 0x15933FB: ACE_Based::Runnable::incReference() (Threading.h:36)
   by 0x1592D2D: ACE_Based::Thread::start() (Threading.cpp:136)
   by 0x1592C37: ACE_Based::Thread::Thread(ACE_Based::Runnable*) (Threading.cpp:111)
   by 0xF6C463: Master::Run() (Master.cpp:195)
   by 0xF725D0: main (Main.cpp:142)
 Address 0x26137278 is 8 bytes inside a block of size 24 free'd
   at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0xF67FDB: RARunnable::~RARunnable() (RARunnable.cpp:55)
   by 0x1593441: ACE_Based::Runnable::decReference() (Threading.h:40)
   by 0x1592E92: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:186)
   by 0x515EA35: ACE_OS_Thread_Adapter::invoke() (in /usr/lib/libACE-6.0.3.so)
   by 0x5F19F8D: start_thread (pthread_create.c:311)
   by 0x6A46E1C: clone (clone.S:113)

Closes #10619
Core/Auth: Implement time-based token for user login as described in RFC 6238.

New column in account table is a base32 of token key bytes,
coincidentally it is the same format Google's Authenticator Android app uses.
If you want that to work, set system time on server correctly and use ntpd.

Closes #10527

Signed-off-by: Nay <dnpd.dd@gmail.com>
Core/Player: Fix uninitialized Player field.

m_MonthlyQuestChanged was initialized only when loading a Player from DB and left uninitialized when creating a new Player.

Valgrind log:
 Conditional jump or move depends on uninitialised value(s)
   at 0x1148E2A: Player::_SaveMonthlyQuestStatus(Trinity::AutoPtr<Transaction, ACE_Thread_Mutex>&) (Player.cpp:19694)
   by 0x1146510: Player::SaveToDB(bool) (Player.cpp:19191)
   by 0x14F5D5C: WorldSession::HandleCharCreateCallback(Trinity::AutoPtr<PreparedResultSet, ACE_Thread_Mutex>, CharacterCreateInfo*) (CharacterHandler.cpp:660)

Closes #10620

Signed-off-by: Nay <dnpd.dd@gmail.com>
Core&Tools: Fix warnings and non-pch build
DB/Sai: Make cauldrons reward buffs
Core/Instances: Fix mutex released after being deleted

Modify how InstanceSave is deleted so the local mutex can be released before deleting the class itself.

Valgrind log:
 Invalid read of size 4
  at 0x662662B: __pthread_mutex_unlock_usercnt (pthread_mutex_unlock.c:52)
  by 0x55D3C55: ACE_OS::mutex_unlock(pthread_mutex_t*) (OS_NS_Thread.cpp:2335)
  by 0xB20057: Player::CleanupsBeforeDelete(bool) (OS_NS_Thread.inl:3519)
  by 0xD0E2FA: WorldSession::LogoutPlayer(bool) (WorldSession.cpp:527)
  by 0xC66D34: WorldSession::HandleLogoutRequestOpcode(WorldPacket&) (MiscHandler.cpp:403)
  by 0xD0EA82: WorldSession::Update(unsigned int, PacketFilter&) (WorldSession.cpp:312)
  by 0xD9AD66: World::UpdateSessions(unsigned int) (World.cpp:2615)
  by 0xD9BEC4: World::Update(unsigned int) (World.cpp:1978)
  by 0xA035E5: WorldRunnable::run() (WorldRunnable.cpp:60)
  by 0xEC8D39: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:183)
  by 0x55D7555: ACE_OS_Thread_Adapter::invoke() (OS_Thread_Adapter.cpp:103)
  by 0x6622B4F: start_thread (pthread_create.c:304)
Address 0x1884bb08 is 56 bytes inside a block of size 104 free'd
  at 0x4C279DC: operator delete(void*) (vg_replace_malloc.c:457)
  by 0xC9D533: InstanceSaveManager::RemoveInstanceSave(unsigned int) (InstanceSaveMgr.cpp:159)
  by 0xC9E826: InstanceSave::UnloadIfEmpty() (InstanceSaveMgr.cpp:238)
  by 0xB2003E: Player::CleanupsBeforeDelete(bool) (InstanceSaveMgr.h:84)
  by 0xD0E2FA: WorldSession::LogoutPlayer(bool) (WorldSession.cpp:527)
  by 0xC66D34: WorldSession::HandleLogoutRequestOpcode(WorldPacket&) (MiscHandler.cpp:403)
  by 0xD0EA82: WorldSession::Update(unsigned int, PacketFilter&) (WorldSession.cpp:312)
  by 0xD9AD66: World::UpdateSessions(unsigned int) (World.cpp:2615)
  by 0xD9BEC4: World::Update(unsigned int) (World.cpp:1978)
  by 0xA035E5: WorldRunnable::run() (WorldRunnable.cpp:60)
  by 0xEC8D39: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:183)
  by 0x55D7555: ACE_OS_Thread_Adapter::invoke() (OS_Thread_Adapter.cpp:103)
Merge pull request #10624 from jackpoz/instancesavemgr

Core/Instances: Fix mutex released after being deleted
DB/SAI: Out of Body Experience (12327)

Fixes #3084
DB/SAI: Ribbly Screwspigot (4136)

Fixes #6911
Core&Tools: Fix multiple issues found by a static code coverage tool
Core/Guild: Fix uninitialized value on guild creation

Fix GuildMember flags left uninitialized when creating a new guild.

Valgrind log:
 Conditional jump or move depends on uninitialised value(s)
  at 0xEE49CE: Guild::Member::WritePacket(WorldPacket&) const (Guild.cpp:714)
  by 0xEE721E: Guild::HandleRoster(WorldSession*) (Guild.cpp:1314)
  by 0xEE9EBA: Guild::SendLoginInfo(WorldSession*) (Guild.cpp:1920)
  by 0xEEB689: Guild::AddMember(unsigned long, unsigned char) (Guild.cpp:2230)
  by 0xEE6A09: Guild::Create(Player*, std::string const&) (Guild.cpp:1199)
  by 0x12A71F9: guild_commandscript::HandleGuildCreateCommand(ChatHandler*, char const*) (cs_guild.cpp:92)
  by 0xC47DBE: ChatHandler::ExecuteCommandInTable(ChatCommand*, char const*, std::string const&) (Chat.cpp:362)
  by 0xC47C23: ChatHandler::ExecuteCommandInTable(ChatCommand*, char const*, std::string const&) (Chat.cpp:343)
  by 0xC488C4: ChatHandler::ParseCommands(char const*) (Chat.cpp:489)
  by 0x1188EE3: WorldSession::HandleMessagechatOpcode(WorldPacket&) (ChatHandler.cpp:217)
  by 0xFCAE37: WorldSession::Update(unsigned int, PacketFilter&) (WorldSession.cpp:312)
  by 0x107EBC6: World::UpdateSessions(unsigned int) (World.cpp:2615)
Merge pull request #10633 from jackpoz/createguild_fix

Core/Guild: Fix uninitialized value on guild creation
DB/Errors: Error fix 

Fixes #10634