File ImageMagick-CVE-2017-11751.patch of Package ImageMagick.8212

From cb713211bad3fa4f0c535255fa043917482fc964 Mon Sep 17 00:00:00 2001
From: Cristy <urban-warrior@imagemagick.org>
Date: Sun, 30 Jul 2017 06:03:57 -0400
Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/631

---
 coders/xpm.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Index: ImageMagick-6.8.8-1/coders/xpm.c
===================================================================
--- ImageMagick-6.8.8-1.orig/coders/xpm.c	2018-01-02 11:01:08.833715010 +0100
+++ ImageMagick-6.8.8-1/coders/xpm.c	2018-01-02 11:01:10.465742927 +0100
@@ -671,7 +671,13 @@ static MagickBooleanType WritePICONImage
   (void) RelinquishUniqueFileResource(blob_info->filename);
   blob_info=DestroyImageInfo(blob_info);
   if ((picon == (Image *) NULL) || (affinity_image == (Image *) NULL))
-    return(MagickFalse);
+    {
+      if (affinity_image != (Image *) NULL)
+        affinity_image=DestroyImage(affinity_image);
+      if (picon != (Image *) NULL)
+        picon=DestroyImage(picon);
+      return(MagickFalse);
+    }
   quantize_info=AcquireQuantizeInfo(image_info);
   status=RemapImage(quantize_info,picon,affinity_image);
   quantize_info=DestroyQuantizeInfo(quantize_info);