[Bug Fix] Handle memory leaks from return value of Client::GetTraderItems() (#2266)

* Move delete of ItemInstance to avoid edge case leaking in ZoneDatabase::LoadWorldContainer()

* Delete ItemInstance after use in Client::Handle_OP_AdventureMerchantPurchase()

* Delete ItemInstance after use in NPC::GetEquipmentMaterial()

* Delete ItemInstance after use in Bot::AddBotItem()

* Delete GetItems_Struct in edge case when !TradeItemsValid in Client::Handle_OP_Trader()

* Move delete GetItems_Struct to handle edge case when Customer is not valid in Client::Trader_EndTrader()
This commit is contained in:
Quintinon
2022-07-02 20:01:42 -07:00
committed by GitHub
parent 445c94bf4a
commit 30f35a920b
5 changed files with 8 additions and 2 deletions
+3
View File
@@ -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;
}