]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/1450
authorCristy <mikayla-grace@urban-warrior.org>
Sun, 20 Jan 2019 16:11:52 +0000 (11:11 -0500)
committerCristy <mikayla-grace@urban-warrior.org>
Sun, 20 Jan 2019 16:11:52 +0000 (11:11 -0500)
coders/pcd.c

index 8eb8ac6526b40160d8f3c3244fa1c03f47fe896d..7e48c138c60b191699276474a12cb61f2461b9b1 100644 (file)
@@ -204,6 +204,8 @@ static MagickBooleanType DecodeImage(Image *image,unsigned char *luma,
     if (pcd_table[i] == (PCDTable *) NULL)
       {
         buffer=(unsigned char *) RelinquishMagickMemory(buffer);
+        for (j=0; j < i; j++)
+          pcd_table[j]=(PCDTable *) RelinquishMagickMemory(pcd_table[j]);
         ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
           image->filename);
       }
@@ -215,6 +217,8 @@ static MagickBooleanType DecodeImage(Image *image,unsigned char *luma,
       if (r->length > 16)
         {
           buffer=(unsigned char *) RelinquishMagickMemory(buffer);
+          for (j=0; j <= i; j++)
+            pcd_table[j]=(PCDTable *) RelinquishMagickMemory(pcd_table[j]);
           return(MagickFalse);
         }
       PCDGetBits(16);