mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Core/AccountMgr: Fix memory leak on account creation
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*)
This commit is contained in:
@@ -54,6 +54,7 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass
|
||||
stmt->setString(3, email);
|
||||
|
||||
LoginDatabase.DirectExecute(stmt); // Enforce saving, otherwise AddGroup can fail
|
||||
delete stmt;
|
||||
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_REALM_CHARACTERS_INIT);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user