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

From 01d522e990aa57cbe67d222dd5e8f7196cc6d199 Mon Sep 17 00:00:00 2001
From: Dirk Lemstra <dirk@git.imagemagick.org>
Date: Sun, 7 May 2017 12:17:18 +0200
Subject: [PATCH] Fixed memory leak reported in #476.

---
 coders/png.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/coders/png.c b/coders/png.c
index a35cbf6437..c7b9fcbd83 100644
--- a/coders/png.c
+++ b/coders/png.c
@@ -5264,7 +5264,10 @@ static Image *ReadOneMNGImage(MngInfo* mng_info, const ImageInfo *image_info,
 
             if ((mng_info->mng_width > 65535L) ||
                 (mng_info->mng_height > 65535L))
-              ThrowReaderException(ImageError,"WidthOrHeightExceedsLimit");
+              {
+                chunk=(unsigned char *) RelinquishMagickMemory(chunk);
+                ThrowReaderException(ImageError,"WidthOrHeightExceedsLimit");
+              }
 
             (void) FormatLocaleString(page_geometry,MaxTextExtent,
               "%.20gx%.20g+0+0",(double) mng_info->mng_width,(double)