Core/DBLayer: Fixed memory leaks with existing SQLQueryHolder uses and eliminated the possibilty of adding more in future (replaced manual memory management with smart pointers)
This commit is contained in:
1 parent
3d29ffeb1a
commit
d6aa5e333e
11 files changed
+80
-99
No files matched your search
@@ -1205,24 +1205,23 @@ public:
|
||||
|
||||
void WorldSession::InitializeSession()
|
||||
{
|
||||
AccountInfoQueryHolderPerRealm* realmHolder = new AccountInfoQueryHolderPerRealm();
|
||||
std::shared_ptr<AccountInfoQueryHolderPerRealm> realmHolder = std::make_shared<AccountInfoQueryHolderPerRealm>();
|
||||
if (!realmHolder->Initialize(GetAccountId(), GetBattlenetAccountId()))
|
||||
{
|
||||
delete realmHolder;
|
||||
SendAuthResponse(AUTH_SYSTEM_ERROR, false);
|
||||
return;
|
||||
}
|
||||
|
||||
AddQueryHolderCallback(CharacterDatabase.DelayQueryHolder(realmHolder)).AfterComplete([this](SQLQueryHolderBase* holder)
|
||||
AddQueryHolderCallback(CharacterDatabase.DelayQueryHolder(realmHolder)).AfterComplete([this](SQLQueryHolderBase const& holder)
|
||||
{
|
||||
InitializeSessionCallback(static_cast<AccountInfoQueryHolderPerRealm*>(holder));
|
||||
InitializeSessionCallback(static_cast<AccountInfoQueryHolderPerRealm const&>(holder));
|
||||
});
|
||||
}
|
||||
|
||||
void WorldSession::InitializeSessionCallback(CharacterDatabaseQueryHolder* realmHolder)
|
||||
void WorldSession::InitializeSessionCallback(CharacterDatabaseQueryHolder const& realmHolder)
|
||||
{
|
||||
LoadAccountData(realmHolder->GetPreparedResult(AccountInfoQueryHolderPerRealm::GLOBAL_ACCOUNT_DATA), GLOBAL_CACHE_MASK);
|
||||
LoadTutorialsData(realmHolder->GetPreparedResult(AccountInfoQueryHolderPerRealm::TUTORIALS));
|
||||
LoadAccountData(realmHolder.GetPreparedResult(AccountInfoQueryHolderPerRealm::GLOBAL_ACCOUNT_DATA), GLOBAL_CACHE_MASK);
|
||||
LoadTutorialsData(realmHolder.GetPreparedResult(AccountInfoQueryHolderPerRealm::TUTORIALS));
|
||||
|
||||
if (!m_inQueue)
|
||||
SendAuthResponse(AUTH_OK, false);
|
||||
@@ -1235,8 +1234,6 @@ void WorldSession::InitializeSessionCallback(CharacterDatabaseQueryHolder* realm
|
||||
SendAddonsInfo();
|
||||
SendClientCacheVersion(sWorld->getIntConfig(CONFIG_CLIENTCACHE_VERSION));
|
||||
SendTutorialsData();
|
||||
|
||||
delete realmHolder;
|
||||
}
|
||||
|
||||
rbac::RBACData* WorldSession::GetRBACData()
|
||||
|
||||
Reference in new issue
Block a user