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:
tomcw 2024-02-18 21:03:32 +00:00
parent 2cbecdda68
commit 0f7bec509a

View File

@ -1731,10 +1731,12 @@ ImageError_e CImageHelperBase::CheckZipFile(LPCTSTR pszImageFilename, ImageInfo*
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;
pImageBuffer = NULL;
}