diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-07 16:47:55 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-07 16:47:55 +0300 |
commit | f6bd1332857b003d258fce4f12a14540208bea2c (patch) | |
tree | 38c7a8dc439835ac12127ec5d5453a19288e566f /src/statuseffect.cpp | |
parent | e5de543efb891e6feb190a85103b1e53406e29c7 (diff) | |
download | manaverse-f6bd1332857b003d258fce4f12a14540208bea2c.tar.gz manaverse-f6bd1332857b003d258fce4f12a14540208bea2c.tar.bz2 manaverse-f6bd1332857b003d258fce4f12a14540208bea2c.tar.xz manaverse-f6bd1332857b003d258fce4f12a14540208bea2c.zip |
fix leak in duplicate status effects.
Diffstat (limited to 'src/statuseffect.cpp')
-rw-r--r-- | src/statuseffect.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index 4c5262250..33579b2dc 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -176,8 +176,12 @@ void StatusEffect::loadXmlFile(const std::string &fileName) if (the_map) { - StatusEffect *const startEffect = new StatusEffect; - StatusEffect *const endEffect = new StatusEffect; + StatusEffect *startEffect = (*the_map)[1][index]; + StatusEffect *endEffect = (*the_map)[0][index]; + if (!startEffect) + startEffect = new StatusEffect; + if (!endEffect) + endEffect = new StatusEffect; startEffect->mMessage = XML::getProperty( node, "start-message", ""); |