Jump to content

memleak?


Guest Dron01

Recommended Posts

Mmm I am not very good at English but I will try to explain what is in my mind.

First I saw the Player::UninviteFromGroup() function which includes these lines:

    if(group->GetMembersCount() <= 1)                       // group has just 1 member => disband
   {
       if(group->IsCreated())
       {
           group->Disband(true);
           sObjectMgr.RemoveGroup(group);
       }
       else
           group->RemoveAllInvites();

       delete group;
   }

See? First, group is getting disbanded and then the destructor of Group class is called and memory is freeing. There's a similar code at all disband group cases.

But look at an another small issue

In function Group:: Disband(bool hideDestroy) there's an unneeded line:

    RollId.clear();

which, afaik, completely clears the pointer list of all existing rolls.

But in destructor, ~Group(), I saw the right way of deletion:

Rolls::iterator itr;
   while(!RollId.empty())
   {
       itr = RollId.begin();
       Roll *r = *itr;
       RollId.erase(itr);
       delete(r);
   }

And so, if group is getting disbanded this way and has existing rolls, they will not be deleted at group destructor because the pointer list is already clear...

Am I right?

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use