diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-09-18 20:22:07 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-09-18 20:22:07 +0000 |
commit | 89dbeaaee05a6ce7adc353f5676df211c1ed83fb (patch) | |
tree | 3f18e18af0248ae555d90f48f0217d3c5371505a /src/resources | |
parent | 761c274a741869ef767d0db2cd8ef0eca149ce3d (diff) | |
download | mana-client-89dbeaaee05a6ce7adc353f5676df211c1ed83fb.tar.gz mana-client-89dbeaaee05a6ce7adc353f5676df211c1ed83fb.tar.bz2 mana-client-89dbeaaee05a6ce7adc353f5676df211c1ed83fb.tar.xz mana-client-89dbeaaee05a6ce7adc353f5676df211c1ed83fb.zip |
Applyed biggeruniverse's patch to fix memory leaks.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/mapreader.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 5e83f34f..b5b1a142 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -129,6 +129,7 @@ Map *MapReader::readMap(const std::string &filename) ResourceManager *resman = ResourceManager::getInstance(); int fileSize; void *buffer = resman->loadFile(filename, fileSize); + Map *map = NULL; if (buffer == NULL) { @@ -175,14 +176,16 @@ Map *MapReader::readMap(const std::string &filename) logger->log("Error: Not a map file (%s)!", filename.c_str()); return NULL; } - - return readMap(node, filename); + else + { + map = readMap(node, filename); + } xmlFreeDoc(doc); } else { logger->log("Error while parsing map file (%s)!", filename.c_str()); } - return NULL; + return map; } Map* MapReader::readMap(xmlNodePtr node, const std::string &path) |