mirror of
https://github.com/love2d/love.git
synced 2026-08-19 12:14:20 +02:00
Fix possible segfault when a DecodeHandler fails to decode an image properly
This commit is contained in:
@@ -124,7 +124,10 @@ void ImageData::decode(love::filesystem::FileData *data)
|
|||||||
// The decoder *must* output a 32 bits-per-pixel image.
|
// The decoder *must* output a 32 bits-per-pixel image.
|
||||||
if (decodedimage.size != decodedimage.width*decodedimage.height*sizeof(pixel))
|
if (decodedimage.size != decodedimage.width*decodedimage.height*sizeof(pixel))
|
||||||
{
|
{
|
||||||
delete[] decodedimage.data;
|
if (decodeHandler)
|
||||||
|
decodeHandler->free(decodedimage.data);
|
||||||
|
else
|
||||||
|
delete[] decodedimage.data;
|
||||||
throw love::Exception("Could not convert image!");
|
throw love::Exception("Could not convert image!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user