summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-08 19:34:50 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-08 19:34:50 +0300
commit652f2cca31626806dc536b4ee3d18aa1d654f569 (patch)
treebd1bcd49ba5b346cb80cf5b554ee71b9d0a36a7d /src/net/ea
parent0c1c6b5df196443b18e9e0ef2e9ef3de350a7234 (diff)
downloadmanaplus-652f2cca31626806dc536b4ee3d18aa1d654f569.tar.gz
manaplus-652f2cca31626806dc536b4ee3d18aa1d654f569.tar.bz2
manaplus-652f2cca31626806dc536b4ee3d18aa1d654f569.tar.xz
manaplus-652f2cca31626806dc536b4ee3d18aa1d654f569.zip
Fix crash in cart and fix different use after free in item options.
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/inventoryitem.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/net/ea/inventoryitem.h b/src/net/ea/inventoryitem.h
index da0f63283..193500d60 100644
--- a/src/net/ea/inventoryitem.h
+++ b/src/net/ea/inventoryitem.h
@@ -92,11 +92,31 @@ class InventoryItem final
cards[f] = cards0[f];
}
+ InventoryItem(const InventoryItem &c) :
+ slot(c.slot),
+ id(c.id),
+ type(c.type),
+ cards(),
+ options(ItemOptionsList::copy(c.options)),
+ quantity(c.quantity),
+ refine(c.refine),
+ color(c.color),
+ identified(c.identified),
+ damaged(c.damaged),
+ favorite(c.favorite),
+ equip(c.equip)
+ {
+ if (!c.cards)
+ return;
+ for (int f = 0; f < 4; f ++)
+ cards[f] = c.cards[f];
+ }
+
A_DEFAULT_COPY(InventoryItem)
~InventoryItem()
{
- delete [] options;
+ delete options;
}
};