From f6bd1332857b003d258fce4f12a14540208bea2c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 7 Jan 2014 16:47:55 +0300 Subject: fix leak in duplicate status effects. --- src/statuseffect.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/statuseffect.cpp') 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", ""); -- cgit v1.2.3-60-g2f50