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

Index: ImageMagick-6.8.8-1/wand/montage.c
===================================================================
--- ImageMagick-6.8.8-1.orig/wand/montage.c	2013-12-01 15:47:50.000000000 +0100
+++ ImageMagick-6.8.8-1/wand/montage.c	2018-01-09 12:01:13.955661191 +0100
@@ -265,6 +265,8 @@ WandExport MagickBooleanType MontageImag
 {
 #define DestroyMontage() \
 { \
+  if (montage_info != (MontageInfo *) NULL) \
+     montage_info=DestroyMontageInfo(montage_info); \
   if (montage_image != (Image *) NULL) \
     montage_image=DestroyImageList(montage_image); \
   DestroyImageStack(); \
@@ -1811,7 +1813,6 @@ WandExport MagickBooleanType MontageImag
           text=DestroyString(text);
         }
     }
-  montage_info=DestroyMontageInfo(montage_info);
   DestroyMontage();
   return(status != 0 ? MagickTrue : MagickFalse);
 }