mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user