Kill another memleak - delete auction element after auction has been ended and removed (fix by ge0rg)

--HG--
branch : trunk
This commit is contained in:
click
2010-07-06 04:49:31 +02:00
parent 6f393be15a
commit 47bfc190c7
2 changed files with 27 additions and 25 deletions
@@ -1,19 +1,19 @@
/* /*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify it
* it under the terms of the GNU General Public License as published by * under the terms of the GNU General Public License as published by the
* the Free Software Foundation; either version 2 of the License, or * Free Software Foundation; either version 2 of the License, or (at your
* (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but WITHOUT
* but WITHOUT ANY WARRANTY; without even the implied warranty of * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* GNU General Public License for more details. * more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, write to the Free Software * with this program. If not, see <http://www.gnu.org/licenses/>.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "Common.h" #include "Common.h"
@@ -481,7 +481,11 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTem
bool AuctionHouseObject::RemoveAuction(AuctionEntry *auction, uint32 item_template) bool AuctionHouseObject::RemoveAuction(AuctionEntry *auction, uint32 item_template)
{ {
auctionbot.DecrementItemCounts(auction, item_template); auctionbot.DecrementItemCounts(auction, item_template);
return AuctionsMap.erase(auction->Id) ? true : false; bool wasInMap = AuctionsMap.erase(auction->Id) ? true : false;
// we need to delete the entry, it is not referenced any more
delete auction;
return wasInMap;
} }
void AuctionHouseObject::Update() void AuctionHouseObject::Update()
+11 -13
View File
@@ -1,21 +1,19 @@
/* /*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
* *
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/> * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
* *
* This program is free software; you can redistribute it and/or modify * This program is distributed in the hope that it will be useful, but WITHOUT
* it under the terms of the GNU General Public License as published by * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* the Free Software Foundation; either version 2 of the License, or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* (at your option) any later version. * more details.
* *
* This program is distributed in the hope that it will be useful, * You should have received a copy of the GNU General Public License along
* but WITHOUT ANY WARRANTY; without even the implied warranty of * with this program. If not, see <http://www.gnu.org/licenses/>.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef _AUCTION_HOUSE_MGR_H #ifndef _AUCTION_HOUSE_MGR_H