Windows: close file handle if the call to GetFileSize fails.

This commit is contained in:
Mounir IDRASSI 2014-11-10 23:10:08 +01:00
parent 51fa86b246
commit b2438b5029

View File

@ -7425,7 +7425,10 @@ char *LoadFile (const char *fileName, DWORD *size)
return NULL; return NULL;
if ((fileSize = GetFileSize (h, NULL)) == INVALID_FILE_SIZE) if ((fileSize = GetFileSize (h, NULL)) == INVALID_FILE_SIZE)
{
CloseHandle (h);
return NULL; return NULL;
}
*size = fileSize; *size = fileSize;
buf = (char *) calloc (*size + 1, 1); buf = (char *) calloc (*size + 1, 1);