From 47bfc190c7b7caf2569a2abd7f4f175f52ecaac5 Mon Sep 17 00:00:00 2001 From: click Date: Tue, 6 Jul 2010 04:49:31 +0200 Subject: Kill another memleak - delete auction element after auction has been ended and removed (fix by ge0rg) --HG-- branch : trunk --- src/server/game/AuctionHouse/AuctionHouseMgr.cpp | 28 ++++++++++++++---------- src/server/game/AuctionHouse/AuctionHouseMgr.h | 24 ++++++++++---------- 2 files changed, 27 insertions(+), 25 deletions(-) (limited to 'src/server') diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 38874336cc4..9b666b1b49c 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -1,19 +1,19 @@ /* + * Copyright (C) 2008-2010 TrinityCore * Copyright (C) 2005-2009 MaNGOS * - * 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 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 distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of 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 + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . */ #include "Common.h" @@ -481,7 +481,11 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTem bool AuctionHouseObject::RemoveAuction(AuctionEntry *auction, uint32 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() diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h index f0eda8f4fc4..24c954a91e8 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.h +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h @@ -1,21 +1,19 @@ /* + * Copyright (C) 2008-2010 TrinityCore * Copyright (C) 2005-2009 MaNGOS * - * Copyright (C) 2008-2010 Trinity + * 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 - * 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 distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * 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 + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . */ #ifndef _AUCTION_HOUSE_MGR_H -- cgit v1.2.3