Commit f7e13da3 authored by Paul Eggert's avatar Paul Eggert
Browse files

* image.c (imagemagick_load_image): Don't use garbage pointer image_wand.

parent 46a4ce9e
......@@ -17,6 +17,7 @@
Remove unused locals. Remove locals to avoid shadowing.
(fn_rsvg_handle_free): Remove; unused.
(svg_load, svg_load_image): Fix pointer signedness problem.
(imagemagick_load_image): Don't use garbage pointer image_wand.
* ftfont.c (ftfont_get_metrics, ftfont_drive_otf): Remove unused locals.
......
......@@ -7550,23 +7550,18 @@ imagemagick_load_image (struct frame *f, struct image *img,
im_image = ReadImage (image_info, exception);
DestroyExceptionInfo (exception);
if (im_image != NULL)
{
image_wand = NewMagickWandFromImage (im_image);
DestroyImage(im_image);
status = MagickTrue;
}
else
status = MagickFalse;
if (im_image == NULL)
goto imagemagick_no_wand;
image_wand = NewMagickWandFromImage (im_image);
DestroyImage(im_image);
}
else
{
image_wand = NewMagickWand ();
status = MagickReadImageBlob (image_wand, contents, size);
if (MagickReadImageBlob (image_wand, contents, size) == MagickFalse)
goto imagemagick_error;
}
if (status == MagickFalse) goto imagemagick_error;
/* If width and/or height is set in the display spec assume we want
to scale to those values. If either h or w is unspecified, the
unspecified should be calculated from the specified to preserve
......@@ -7794,6 +7789,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
imagemagick_error:
DestroyMagickWand (image_wand);
imagemagick_no_wand:
MagickWandTerminus ();
/* TODO more cleanup. */
image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment