mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 07:21:48 +00:00
[Memory Leak] Fix leak in NPC::RemoveItem (#4611)
* [Memory Leak] Fix leak in NPC::RemoveItem * Update loot.cpp
This commit is contained in:
parent
861eac3660
commit
b2f71f16fc
@ -687,6 +687,7 @@ void NPC::RemoveItem(uint32 item_id, uint16 quantity, uint16 slot)
|
|||||||
LootItem *item = *cur;
|
LootItem *item = *cur;
|
||||||
if (item->item_id == item_id && slot <= 0 && quantity <= 0) {
|
if (item->item_id == item_id && slot <= 0 && quantity <= 0) {
|
||||||
m_loot_items.erase(cur);
|
m_loot_items.erase(cur);
|
||||||
|
safe_delete(item);
|
||||||
UpdateEquipmentLight();
|
UpdateEquipmentLight();
|
||||||
if (UpdateActiveLight()) { SendAppearancePacket(AppearanceType::Light, GetActiveLightType()); }
|
if (UpdateActiveLight()) { SendAppearancePacket(AppearanceType::Light, GetActiveLightType()); }
|
||||||
return;
|
return;
|
||||||
@ -694,6 +695,7 @@ void NPC::RemoveItem(uint32 item_id, uint16 quantity, uint16 slot)
|
|||||||
else if (item->item_id == item_id && item->equip_slot == slot && quantity >= 1) {
|
else if (item->item_id == item_id && item->equip_slot == slot && quantity >= 1) {
|
||||||
if (item->charges <= quantity) {
|
if (item->charges <= quantity) {
|
||||||
m_loot_items.erase(cur);
|
m_loot_items.erase(cur);
|
||||||
|
safe_delete(item);
|
||||||
UpdateEquipmentLight();
|
UpdateEquipmentLight();
|
||||||
if (UpdateActiveLight()) { SendAppearancePacket(AppearanceType::Light, GetActiveLightType()); }
|
if (UpdateActiveLight()) { SendAppearancePacket(AppearanceType::Light, GetActiveLightType()); }
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user