summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-07 14:51:36 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-07 14:51:36 +0300
commit8eb9c7cb395aa1607161ec1805b2ceeaec0a6513 (patch)
treea500fba40a395837ec4b94f93e22e4ba09b54e29 /src/resources
parent5ea427865209cc2b976fc84aadcd257b35e6bd79 (diff)
downloadmanaverse-8eb9c7cb395aa1607161ec1805b2ceeaec0a6513.tar.gz
manaverse-8eb9c7cb395aa1607161ec1805b2ceeaec0a6513.tar.bz2
manaverse-8eb9c7cb395aa1607161ec1805b2ceeaec0a6513.tar.xz
manaverse-8eb9c7cb395aa1607161ec1805b2ceeaec0a6513.zip
fix leak in emotedb with duplicate emotes.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/db/emotedb.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/resources/db/emotedb.cpp b/src/resources/db/emotedb.cpp
index 907bb75c4..7c710795f 100644
--- a/src/resources/db/emotedb.cpp
+++ b/src/resources/db/emotedb.cpp
@@ -100,8 +100,11 @@ void EmoteDB::loadXmlFile(const std::string &fileName)
paths.getStringValue("emotesFile").c_str());
continue;
}
-
- EmoteInfo *const currentInfo = new EmoteInfo;
+ EmoteInfo *currentInfo = nullptr;
+ if (mEmoteInfos.find(id) != mEmoteInfos.end())
+ currentInfo = mEmoteInfos[id];
+ else
+ currentInfo = new EmoteInfo;
currentInfo->time = XML::getProperty(emoteNode, "time", 500);
for_each_xml_child_node(spriteNode, emoteNode)
@@ -169,7 +172,11 @@ void EmoteDB::loadSpecialXmlFile(const std::string &fileName)
}
const int altId = XML::getProperty(emoteNode, "altid", -1);
- EmoteInfo *const currentInfo = new EmoteInfo;
+ EmoteInfo *currentInfo = nullptr;
+ if (mEmoteInfos.find(id) != mEmoteInfos.end())
+ currentInfo = mEmoteInfos[id];
+ if (!currentInfo)
+ currentInfo = new EmoteInfo;
currentInfo->time = XML::getProperty(emoteNode, "time", 500);
for_each_xml_child_node(spriteNode, emoteNode)