File ImageMagick-CVE-2017-12671,13141.patch of Package ImageMagick.8212

Index: ImageMagick-6.8.8-1/coders/png.c
===================================================================
--- ImageMagick-6.8.8-1.orig/coders/png.c	2018-01-12 13:20:56.799594343 +0100
+++ ImageMagick-6.8.8-1/coders/png.c	2018-01-12 13:31:21.189848994 +0100
@@ -2106,6 +2106,9 @@ static Image *ReadOnePNGImage(MngInfo *m
     x_resolution,
     y_resolution;
 
+  Quantum
+    *volatile quantum_scanline;
+
   QuantumInfo
     *volatile quantum_info;
 
@@ -2301,6 +2304,7 @@ static Image *ReadOnePNGImage(MngInfo *m
 
   pixel_info=(MemoryInfo *) NULL;
   quantum_info = (QuantumInfo *) NULL;
+  quantum_scanline = (Quantum *) NULL;
 
   if (setjmp(png_jmpbuf(ping)))
     {
@@ -2319,6 +2323,9 @@ static Image *ReadOnePNGImage(MngInfo *m
       if (quantum_info != (QuantumInfo *) NULL)
         quantum_info=DestroyQuantumInfo(quantum_info);
 
+      if (quantum_scanline != (Quantum *) NULL)
+        quantum_scanline=(Quantum *) RelinquishMagickMemory(quantum_scanline);
+
       if (logging != MagickFalse)
         (void) LogMagickEvent(CoderEvent,GetMagickModule(),
           "  exit ReadOnePNGImage() with error.");
@@ -3345,9 +3352,6 @@ static Image *ReadOnePNGImage(MngInfo *m
 
     for (pass=0; pass < num_passes; pass++)
     {
-      Quantum
-        *quantum_scanline;
-
       register Quantum
         *r;