Scripts/Commands: Fix memory leak in ".reload command"

Free commandTableCache object before assigning it the result of malloc()

(cherry picked from commit c6c09423fd)
This commit is contained in:
jackpoz
2015-06-20 22:42:30 +02:00
committed by DDuarte
parent a5d5f98c38
commit a3faa57f3b

View File

@@ -81,6 +81,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);