mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-30 09:30:15 +00:00
Floppy/Harddisk images: on failure, close handle for all return paths. (Fixes #1227)
This commit is contained in:
parent
1127447a10
commit
4786de0cc7
@ -68,18 +68,23 @@ ImageError_e ImageOpen( const std::string & pszImageFilename,
|
||||
if (pImageInfo->pImageType && pImageInfo->pImageType->GetType() == eImageHDV)
|
||||
{
|
||||
if (bExpectFloppy)
|
||||
{
|
||||
ImageClose(*ppImageInfo);
|
||||
*ppImageInfo = NULL;
|
||||
Err = eIMAGE_ERROR_UNSUPPORTED_HDV;
|
||||
}
|
||||
return Err;
|
||||
}
|
||||
|
||||
// THE FILE MATCHES A KNOWN FORMAT
|
||||
|
||||
_ASSERT(bExpectFloppy);
|
||||
if (!bExpectFloppy)
|
||||
return eIMAGE_ERROR_UNSUPPORTED;
|
||||
|
||||
if (!pImageInfo->uNumTracks)
|
||||
if (!bExpectFloppy || !pImageInfo->uNumTracks)
|
||||
{
|
||||
ImageClose(*ppImageInfo);
|
||||
*ppImageInfo = NULL;
|
||||
return eIMAGE_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
*pWriteProtected = pImageInfo->bWriteProtected;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user