diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-02-19 05:47:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-02-19 23:04:53 +0300 |
commit | 80ba4766d8ce9861f6d026e791abc741e3fed0f4 (patch) | |
tree | 02d509ecd3ae384fba0b8d44a60c71033e3d31d3 /src/resources/db/deaddb.cpp | |
parent | 4526407e2001244a03674e57db8a6807cbbbe2b0 (diff) | |
download | manaplus-80ba4766d8ce9861f6d026e791abc741e3fed0f4.tar.gz manaplus-80ba4766d8ce9861f6d026e791abc741e3fed0f4.tar.bz2 manaplus-80ba4766d8ce9861f6d026e791abc741e3fed0f4.tar.xz manaplus-80ba4766d8ce9861f6d026e791abc741e3fed0f4.zip |
Fix some memory leaks and add duplicate item fields check.
Diffstat (limited to 'src/resources/db/deaddb.cpp')
-rw-r--r-- | src/resources/db/deaddb.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/resources/db/deaddb.cpp b/src/resources/db/deaddb.cpp index 251ae3a33..778d88a0b 100644 --- a/src/resources/db/deaddb.cpp +++ b/src/resources/db/deaddb.cpp @@ -73,11 +73,17 @@ void DeadDB::loadXmlFile(const std::string &fileName, } else if (xmlNameEqual(node, "message")) { - const char *const data = reinterpret_cast<const char*>( + char *const data = reinterpret_cast<char*>( XmlNodeGetContent(node)); - if (!data || !*data) + if (!data) continue; + if (!*data) + { + XmlFree(data); + continue; + } mMessages.push_back(data); + XmlFree(data); } } |