]> granicus.if.org Git - imagemagick/commitdiff
Fixed memory leak reported in #476.
authorDirk Lemstra <dirk@git.imagemagick.org>
Sun, 7 May 2017 10:17:31 +0000 (12:17 +0200)
committerDirk Lemstra <dirk@git.imagemagick.org>
Sun, 7 May 2017 10:17:31 +0000 (12:17 +0200)
coders/png.c

index d212497dd41a6a15ba2dac695ff9cc4763e06b55..c194d08585cf95ab11d7881523f0e892cb26240f 100644 (file)
@@ -5579,7 +5579,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,MagickPathExtent,
               "%.20gx%.20g+0+0",(double) mng_info->mng_width,(double)