diff --git a/zone/bot.cpp b/zone/bot.cpp index e3eb18754..f15a04f86 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -4283,10 +4283,12 @@ void Bot::AddBotItem( if (!database.botdb.SaveItemBySlot(this, slot_id, inst)) { LogError("Failed to save item by slot to slot [{}] for [{}].", slot_id, GetCleanName()); + safe_delete(inst); return; } m_inv.PutItem(slot_id, *inst); + safe_delete(inst); BotAddEquipItem(slot_id, item_id); } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 9e62987fd..ea945ad30 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2039,6 +2039,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) { PutLootInInventory(EQ::invslot::slotCursor, *inst); } + safe_delete(inst); Save(1); } @@ -2549,6 +2550,7 @@ void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app) { PutLootInInventory(EQ::invslot::slotCursor, *inst); } + safe_delete(inst); Save(1); } @@ -14463,6 +14465,7 @@ void Client::Handle_OP_Trader(const EQApplicationPacket *app) if (!TradeItemsValid) { Trader_EndTrader(); + safe_delete(gis); return; } diff --git a/zone/npc.cpp b/zone/npc.cpp index d6019ab92..0a14947b4 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -1903,6 +1903,7 @@ void NPC::PickPocket(Client* thief) } RemoveItem(item_inst->GetID()); thief->SendPickPocketResponse(this, 0, PickPocketItem, item_inst->GetItem()); + safe_delete(item_inst); return; } diff --git a/zone/trading.cpp b/zone/trading.cpp index 6fad3a4b0..598928547 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -1151,8 +1151,8 @@ void Client::Trader_EndTrader() { } safe_delete(outapp); - safe_delete(gis); } + safe_delete(gis); } database.DeleteTraderItem(CharacterID()); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 00c18513f..488efa24a 100755 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -675,8 +675,8 @@ void ZoneDatabase::LoadWorldContainer(uint32 parentid, EQ::ItemInstance* contain inst->PutAugment(&database, i, aug[i]); // Put item inside world container container->PutItem(index, *inst); - safe_delete(inst); } + safe_delete(inst); } }