mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-23 00:30:17 +00:00
Zip file support: avoid double-free if there's a problem with the zip file (eg. no valid image type)
This commit is contained in:
parent
2cbecdda68
commit
0f7bec509a
@ -1731,10 +1731,12 @@ ImageError_e CImageHelperBase::CheckZipFile(LPCTSTR pszImageFilename, ImageInfo*
|
|||||||
|
|
||||||
SetImageInfo(pImageInfo, eFileZip, dwOffset, pImageType, dwSize);
|
SetImageInfo(pImageInfo, eFileZip, dwOffset, pImageType, dwSize);
|
||||||
|
|
||||||
pImageInfo2 = new ImageInfo(); // use this dummy one, as some members get overwritten during Detect()
|
pImageInfo2 = new ImageInfo(); // use this dummy one for remaining entries in zip archive, as some members get overwritten during Detect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pImageInfo->pImageBuffer == pImageBuffer) // on error: avoid double-free when parent calls ImageClose()
|
||||||
|
pImageInfo->pImageBuffer = NULL;
|
||||||
delete [] pImageBuffer;
|
delete [] pImageBuffer;
|
||||||
pImageBuffer = NULL;
|
pImageBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user