From: Cristy Date: Fri, 17 Mar 2017 11:14:25 +0000 (-0400) Subject: Eliminate possible but rare memory leak (bug report by Dirk) X-Git-Tag: 7.0.5-3~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f1cc2eb986dc8f4a7727bce689a17566f896fde6;p=imagemagick Eliminate possible but rare memory leak (bug report by Dirk) --- diff --git a/coders/pgx.c b/coders/pgx.c index e03981f87..04a5f2c99 100644 --- a/coders/pgx.c +++ b/coders/pgx.c @@ -376,7 +376,7 @@ static MagickBooleanType WritePGXImage(const ImageInfo *image_info,Image *image, GrayQuantum,pixels,exception); count=WriteBlob(image,length,pixels); if (count != (ssize_t) length) - ThrowWriterException(CorruptImageError,"UnableToWriteImageData"); + break; count=WriteBlob(image,(size_t) (-(ssize_t) length) & 0x01,pixels); status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); @@ -384,6 +384,8 @@ static MagickBooleanType WritePGXImage(const ImageInfo *image_info,Image *image, break; } quantum_info=DestroyQuantumInfo(quantum_info); + if (y < (ssize_t) image->rows) + ThrowWriterException(CorruptImageError,"UnableToWriteImageData"); (void) CloseBlob(image); return(status); }