[11534] Guild disban memory losses and unsafe code.

* Make sure that guild object deleted in all cases after disband.
* Avoid recusive like way call Disband from DelMember
This commit is contained in:
VladimirMangos 2011-05-25 03:19:42 +04:00
parent b5c3ec952f
commit 2cbde12458
6 changed files with 59 additions and 19 deletions

View file

@ -3608,7 +3608,12 @@ bool ChatHandler::HandleGuildUninviteCommand(char *args)
if (!targetGuild)
return false;
targetGuild->DelMember(target_guid);
if (targetGuild->DelMember(target_guid))
{
targetGuild->Disband();
delete targetGuild;
}
return true;
}
@ -3651,7 +3656,7 @@ bool ChatHandler::HandleGuildDeleteCommand(char* args)
return false;
char* guildStr = ExtractQuotedArg(&args);
if(!guildStr)
if (!guildStr)
return false;
std::string gld = guildStr;
@ -3660,7 +3665,8 @@ bool ChatHandler::HandleGuildDeleteCommand(char* args)
if (!targetGuild)
return false;
targetGuild->Disband ();
targetGuild->Disband();
delete targetGuild;
return true;
}