mingw: fix handle leak in File::size

pull/511/head
Nils Maier 2015-12-01 14:24:17 +01:00
parent 8fbfb3ac84
commit cccbc59026
1 changed files with 2 additions and 4 deletions

View File

@ -131,11 +131,9 @@ int64_t File::size()
return 0;
}
LARGE_INTEGER fileSize;
if (!GetFileSizeEx(hn, &fileSize)) {
return 0;
}
const auto rv = GetFileSizeEx(hn, &fileSize);
CloseHandle(hn);
return fileSize.QuadPart;
return rv ? fileSize.QuadPart : 0;
#else // !__MINGW32__
a2_struct_stat fstat;
if(fillStat(fstat) < 0) {