Skip to content

Commit fdb5887

Browse files
Fix potential memory leak when adding partybots (vmangos#3006)
1 parent f4a971d commit fdb5887

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/game/PlayerBots/PlayerBotMgr.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,7 @@ bool ChatHandler::HandlePartyBotAddCommand(char* args)
940940
SendSysMessage("New party bot added.");
941941
else
942942
{
943+
delete ai;
943944
SendSysMessage("Error spawning bot.");
944945
SetSentErrorMessage(true);
945946
return false;
@@ -979,6 +980,7 @@ bool ChatHandler::HandlePartyBotCloneCommand(char* args)
979980
SendSysMessage("New party bot added.");
980981
else
981982
{
983+
delete ai;
982984
SendSysMessage("Error spawning bot.");
983985
SetSentErrorMessage(true);
984986
return false;

0 commit comments

Comments
 (0)