Merge from savannah/emacs-30

b5543c54bf Fix NULL pointer dereferences in xpm_load_image
This commit is contained in:
Po Lu 2024-07-24 11:58:29 +08:00
commit e673492f74

View file

@ -3887,7 +3887,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
static void
x_destroy_x_image (XImage *ximg)
{
if (ximg)
if (ximg->data)
{
xfree (ximg->data);
ximg->data = NULL;
@ -6502,9 +6502,12 @@ xpm_load_image (struct frame *f,
failure:
image_error ("Invalid XPM3 file (%s)", img->spec);
image_destroy_x_image (ximg);
image_destroy_x_image (mask_img);
image_clear_image (f, img);
if (ximg)
{
image_destroy_x_image (ximg);
image_destroy_x_image (mask_img);
image_clear_image (f, img);
}
return 0;
#undef match