https://github.com/ImageMagick/ImageMagick/issues/58
authorCristy <urban-warrior@imagemagick.org>
Tue, 18 Jul 2017 22:12:58 +0000 (18:12 -0400)
committerCristy <urban-warrior@imagemagick.org>
Tue, 18 Jul 2017 22:12:58 +0000 (18:12 -0400)
coders/png.c

index f6ddf6d7c3e2211a61cc3e2fdb3513023690ffee..c61b6874e7ad5c817a732bece839eae339bc03a7 100644 (file)
@@ -8270,9 +8270,11 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
     "  Enter WriteOnePNGImage()");
 
   image = CloneImage(IMimage,0,0,MagickFalse,exception);
+  if (image == (Image *) NULL)
+    return(MagickFalse);
   image_info=(ImageInfo *) CloneImageInfo(IMimage_info);
   if (image_info == (ImageInfo *) NULL)
-     ThrowWriterException(ResourceLimitError, "MemoryAllocationFailed");
+    ThrowWriterException(ResourceLimitError, "MemoryAllocationFailed");
 
   /* Define these outside of the following "if logging()" block so they will
    * show in debuggers.