* src/image.c (x_destroy_x_image): Correct test condition.
(xpm_load_image): Do not release image data if it is still to be
created.
(cherry picked from commit
b5543c54bf08c4fa4cae6b7f404a37a2aee60cdf)
static void
x_destroy_x_image (XImage *ximg)
{
- if (ximg)
+ if (ximg->data)
{
xfree (ximg->data);
ximg->data = NULL;
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