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

From c2be129c25763680afeca59f4de5d6d4240ca2cf Mon Sep 17 00:00:00 2001
From: Dirk Lemstra <dirk@git.imagemagick.org>
Date: Tue, 2 May 2017 09:05:15 +0200
Subject: [PATCH] Fixed memory leak reported in #462.

---
 coders/psd.c | 2 ++
 1 file changed, 2 insertions(+)

Index: ImageMagick-6.8.8-1/coders/psd.c
===================================================================
--- ImageMagick-6.8.8-1.orig/coders/psd.c	2017-06-28 11:00:37.985705984 +0200
+++ ImageMagick-6.8.8-1/coders/psd.c	2017-06-28 11:02:36.331761723 +0200
@@ -970,12 +970,14 @@ static MagickStatusType ReadPSDChannelZi
         ret=inflate(&stream, Z_SYNC_FLUSH);
         if (ret != Z_OK && ret != Z_STREAM_END)
         {
+          (void) inflateEnd(&stream);
           compact_pixels=(unsigned char *) RelinquishMagickMemory(
             compact_pixels);
           pixels=(unsigned char *) RelinquishMagickMemory(pixels);
           return(MagickFalse);
         }
       }
+      (void) inflateEnd(&stream);
     }
 
   if (compression == ZipWithPrediction)