From 89dbeaaee05a6ce7adc353f5676df211c1ed83fb Mon Sep 17 00:00:00 2001 From: Eugenio Favalli Date: Sun, 18 Sep 2005 20:22:07 +0000 Subject: Applyed biggeruniverse's patch to fix memory leaks. --- src/resources/mapreader.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/resources/mapreader.cpp') 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) -- cgit v1.2.3-70-g09d2