From: Dirk Lemstra Date: Sun, 18 Feb 2018 13:27:23 +0000 (+0100) Subject: Fixed memory leak. X-Git-Tag: 7.0.7-23~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b517fc1f683dc2e54ed0e93ecdb8b956c773ce45;p=imagemagick Fixed memory leak. --- diff --git a/MagickCore/blob.c b/MagickCore/blob.c index db5dbf227..c0934cda8 100644 --- a/MagickCore/blob.c +++ b/MagickCore/blob.c @@ -1912,7 +1912,9 @@ MagickExport void *ImageToBlob(const ImageInfo *image_info, status=WriteImage(blob_info,image,exception); *length=image->blob->length; blob=DetachBlob(image->blob); - if (status == MagickFalse) + if (blob == (void *) NULL) + blob_info->blob=RelinquishMagickMemory(blob_info->blob); + else if (status == MagickFalse) blob=RelinquishMagickMemory(blob); else blob=ResizeQuantumMemory(blob,*length+1,sizeof(unsigned char)); @@ -2308,7 +2310,9 @@ MagickExport void *ImagesToBlob(const ImageInfo *image_info,Image *images, status=WriteImages(clone_info,images,images->filename,exception); *length=images->blob->length; blob=DetachBlob(images->blob); - if (status == MagickFalse) + if (blob == (void *) NULL) + clone_info->blob=RelinquishMagickMemory(clone_info->blob); + else if (status == MagickFalse) blob=RelinquishMagickMemory(blob); else blob=ResizeQuantumMemory(blob,*length+1,sizeof(unsigned char));