aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2013-09-21 14:55:08 +0200
committerjackpoz <giacomopoz@gmail.com>2013-09-21 14:55:08 +0200
commita26a24adf1e62f2d4dad19a8a3eed5ab0ff1f112 (patch)
treef0d4ce95c5982a01fe23b733264431337e043287
parent69b0a009c4c99b858296d4cbc5f86a87258f6699 (diff)
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*)
-rw-r--r--src/server/game/Accounts/AccountMgr.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp
index 819a3b85fe6..b3dec265617 100644
--- a/src/server/game/Accounts/AccountMgr.cpp
+++ b/src/server/game/Accounts/AccountMgr.cpp
@@ -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);