From: cristy Date: Tue, 13 Jan 2015 15:26:30 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~1443 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ed140508d586d6188fefb5e780f07a490f9ec14;p=imagemagick --- diff --git a/coders/jbig.c b/coders/jbig.c index ae230f7ae..908538466 100644 --- a/coders/jbig.c +++ b/coders/jbig.c @@ -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. */