File GraphicsMagick-CVE-2017-18251.patch of Package GraphicsMagick.openSUSE_Leap_42.3_Update

--- a/coders/pcd.c	Sat Sep 30 16:48:42 2017 -0500
+++ b/coders/pcd.c	Sat Sep 30 16:53:07 2017 -0500
@@ -621,8 +621,14 @@
   chroma2=MagickAllocateMemory(unsigned char *,number_pixels+1);
   luma=MagickAllocateMemory(unsigned char *,number_pixels+1);
   if ((chroma1 == (unsigned char *) NULL) ||
-      (chroma2 == (unsigned char *) NULL) || (luma == (unsigned char *) NULL))
-    ThrowReaderException(ResourceLimitError,MemoryAllocationFailed,image);
+      (chroma2 == (unsigned char *) NULL) ||
+      (luma == (unsigned char *) NULL))
+    {
+      MagickFreeMemory(chroma1);
+      MagickFreeMemory(chroma2);
+      MagickFreeMemory(luma);
+      ThrowReaderException(ResourceLimitError,MemoryAllocationFailed,image);
+    }
   /*
     Advance to image data.
   */
openSUSE Build Service is sponsored by