]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Tue, 13 Jan 2015 15:26:30 +0000 (15:26 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Tue, 13 Jan 2015 15:26:30 +0000 (15:26 +0000)
coders/jbig.c

index ae230f7aec6694f4b9b251c66ce040d0f13b256b..908538466237e9faf6f7b4e9dae827c5ab1694ec 100644 (file)
@@ -173,7 +173,10 @@ static Image *ReadJBIGImage(const ImageInfo *image_info,
   buffer=(unsigned char *) AcquireQuantumMemory(MagickMaxBufferExtent,
     sizeof(*buffer));
   if (buffer == (unsigned char *) NULL)
-    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+    {
+      jbg_dec_free(&jbig_info);
+      ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+    }
   status=JBG_EAGAIN;
   do
   {
@@ -199,6 +202,7 @@ static Image *ReadJBIGImage(const ImageInfo *image_info,
   image->compression=JBIG2Compression;
   if (AcquireImageColormap(image,2,exception) == MagickFalse)
     {
+      jbg_dec_free(&jbig_info);
       buffer=(unsigned char *) RelinquishMagickMemory(buffer);
       ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
     }
@@ -212,12 +216,18 @@ static Image *ReadJBIGImage(const ImageInfo *image_info,
   image->resolution.y=300;
   if (image_info->ping != MagickFalse)
     {
+      jbg_dec_free(&jbig_info);
+      buffer=(unsigned char *) RelinquishMagickMemory(buffer);
       (void) CloseBlob(image);
       return(GetFirstImageInList(image));
     }
   status=SetImageExtent(image,image->columns,image->rows,exception);
   if (status == MagickFalse)
-    return(DestroyImageList(image));
+    {
+      jbg_dec_free(&jbig_info);
+      buffer=(unsigned char *) RelinquishMagickMemory(buffer);
+      return(DestroyImageList(image));
+    }
   /*
     Convert X bitmap image to pixel packets.
   */