Merge pull request #9792 from minggo/memory-leak

fix memory leak
This commit is contained in:
minggo 2015-01-05 14:20:49 +08:00
commit ef5076983d
1 changed files with 6 additions and 2 deletions

View File

@ -168,8 +168,12 @@ static Data getData(const std::string& filename, bool forString)
if (!successed)
{
free(buffer);
buffer = nullptr;
// should determine buffer value, or it will cause memory leak
if (buffer)
{
free(buffer);
buffer = nullptr;
}
}
} while (0);