mirror of https://github.com/GNOME/gimp.git
plug-ins: handle memory allocation failure in JXL import
This commit is contained in:
parent
40ca022c81
commit
422d5fec8f
|
@ -497,7 +497,20 @@ load_image (GFile *file,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
picture_buffer = g_malloc (result_size);
|
||||
picture_buffer = g_try_malloc (result_size);
|
||||
if (!picture_buffer)
|
||||
{
|
||||
g_set_error (error, G_FILE_ERROR, 0, "Memory could not be allocated.");
|
||||
if (profile)
|
||||
{
|
||||
g_object_unref (profile);
|
||||
}
|
||||
JxlThreadParallelRunnerDestroy (runner);
|
||||
JxlDecoderDestroy (decoder);
|
||||
g_free (memory);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (JxlDecoderSetImageOutBuffer (decoder, &pixel_format, picture_buffer, result_size) != JXL_DEC_SUCCESS)
|
||||
{
|
||||
g_set_error (error, G_FILE_ERROR, 0,
|
||||
|
|
Loading…
Reference in New Issue