aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2015-06-20 22:42:30 +0200
committerjackpoz <giacomopoz@gmail.com>2015-06-20 22:42:30 +0200
commitc6c09423fd226a970b0b39cdd2586e9ae3a07f6b (patch)
tree9416e5d3eefd2f7d1d793339995e6df28e62a5eb /src
parenta5b3862bc1b066a9614369bda3adef485a57eff8 (diff)
Scripts/Commands: Fix memory leak in ".reload command"
Free commandTableCache object before assigning it the result of malloc()
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Chat/Chat.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index 1716aa73525..3cbdcbcaff1 100644
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -78,6 +78,7 @@ ChatCommand* ChatHandler::getCommandTable()
// cache top-level commands
size_t added = 0;
+ free(commandTableCache);
commandTableCache = (ChatCommand*)malloc(sizeof(ChatCommand) * total);
ASSERT(commandTableCache);
memset(commandTableCache, 0, sizeof(ChatCommand) * total);