Fixes memory leaks of using FileUtils::getInstance()->getFileData() in FlatBuffersSerialize.cpp.

This commit is contained in:
pipu 2015-01-19 11:45:20 +08:00
parent d1c0c0eeb6
commit 103fecf3ef
1 changed files with 4 additions and 4 deletions

View File

@ -150,8 +150,8 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFile(const std::str
return ".csd file doesn not exists ";
}
ssize_t size;
std::string content =(char*)FileUtils::getInstance()->getFileData(inFullpath, "r", &size);
std::string content = FileUtils::getInstance()->getStringFromFile(inFullpath);
FileUtils::getInstance()->purgeCachedEntries();
// xml parse
tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument();
@ -1124,8 +1124,8 @@ FlatBufferBuilder* FlatBuffersSerialize::createFlatBuffersWithXMLFileForSimulato
// CCLOG(".csd file doesn not exists ");
}
ssize_t size;
std::string content =(char*)FileUtils::getInstance()->getFileData(inFullpath, "r", &size);
std::string content = FileUtils::getInstance()->getStringFromFile(inFullpath);
FileUtils::getInstance()->purgeCachedEntries();
// xml parse
tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument();