File ImageMagick-CVE-2019-16708,16709.patch of Package ImageMagick.30356
diff --git a/MagickCore/xwindow.c b/MagickCore/xwindow.c
index 6da05d9a16..228b856cd1 100644
--- a/MagickCore/xwindow.c
+++ b/MagickCore/xwindow.c
@@ -309,6 +309,11 @@ MagickExport void DestroyXResources(void)
(void) XFreePixmap(windows->display,magick_windows[i]->shadow_stipple);
magick_windows[i]->shadow_stipple=(Pixmap) NULL;
}
+ if (magick_windows[i]->matte_image != (XImage *) NULL)
+ {
+ XDestroyImage(magick_windows[i]->matte_image);
+ magick_windows[i]->matte_image=(XImage *) NULL;
+ }
if (magick_windows[i]->ximage != (XImage *) NULL)
{
XDestroyImage(magick_windows[i]->ximage);
diff --git a/coders/dps.c b/coders/dps.c
index 68a28b3de1..5ffbcc6668 100644
--- a/coders/dps.c
+++ b/coders/dps.c
@@ -174,7 +174,10 @@ static Image *ReadDPSImage(const ImageInfo *image_info,ExceptionInfo *exception)
image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
- return((Image *) NULL);
+ {
+ image=DestroyImageList(image);
+ return((Image *) NULL);
+ }
/*
Get user defaults from X resource database.
*/