Merge pull request #16127 from mogemimi/add-missing-fclose

Add missing fclose() to fix a possible bug caused by PR #16114
This commit is contained in:
minggo 2016-07-15 18:32:33 +08:00 committed by GitHub
commit 1544b8eed0
1 changed files with 1 additions and 0 deletions

View File

@ -647,6 +647,7 @@ FileUtils::Status FileUtils::getContents(const std::string& filename, ResizableB
#endif #endif
struct stat statBuf; struct stat statBuf;
if (fstat(descriptor, &statBuf) == -1) { if (fstat(descriptor, &statBuf) == -1) {
fclose(fp);
return Status::ReadFailed; return Status::ReadFailed;
} }
size_t size = statBuf.st_size; size_t size = statBuf.st_size;