]> granicus.if.org Git - imagemagick/commitdiff
Fixed memory leak reported in #457.
authorDirk Lemstra <dirk@git.imagemagick.org>
Tue, 2 May 2017 06:34:04 +0000 (08:34 +0200)
committerDirk Lemstra <dirk@git.imagemagick.org>
Tue, 2 May 2017 06:34:04 +0000 (08:34 +0200)
coders/icon.c

index ae6a1ed1a62ade34d4d2265ac296663791608573..5e854d0cb47e8d117b3725784fd388540b91fd61 100644 (file)
@@ -455,8 +455,12 @@ static Image *ReadICONImage(const ImageInfo *image_info,
             ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
           count=ReadBlob(image,(size_t) (4*image->colors),icon_colormap);
           if (count != (ssize_t) (4*image->colors))
-            ThrowReaderException(CorruptImageError,
-              "InsufficientImageDataInFile");
+            {
+              icon_colormap=(unsigned char *) RelinquishMagickMemory(
+                icon_colormap);
+              ThrowReaderException(CorruptImageError,
+                "InsufficientImageDataInFile");
+            }
           p=icon_colormap;
           for (i=0; i < (ssize_t) image->colors; i++)
           {