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:
jackpoz
2013-09-21 14:55:08 +02:00
parent 69b0a009c4
commit a26a24adf1

View File

@@ -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);