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; return 0;
} }
LARGE_INTEGER fileSize; LARGE_INTEGER fileSize;
if (!GetFileSizeEx(hn, &fileSize)) { const auto rv = GetFileSizeEx(hn, &fileSize);
return 0;
}
CloseHandle(hn); CloseHandle(hn);
return fileSize.QuadPart; return rv ? fileSize.QuadPart : 0;
#else // !__MINGW32__ #else // !__MINGW32__
a2_struct_stat fstat; a2_struct_stat fstat;
if(fillStat(fstat) < 0) { if(fillStat(fstat) < 0) {