From eb005622e2827836baaf5efc2239326b8c44060e Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 27 Apr 2018 16:26:36 -0400 Subject: [PATCH] Fixed memory leak in heif --- coders/heic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coders/heic.c b/coders/heic.c index 8fa660782..f84811585 100644 --- a/coders/heic.c +++ b/coders/heic.c @@ -191,7 +191,10 @@ static Image *ReadHEICImage(const ImageInfo *image_info, error=heif_context_read_from_memory(heif_context,file_data,length,NULL); file_data=RelinquishMagickMemory(file_data); if (error.code != 0) - ThrowReaderException(CorruptImageError,"UnableToReadImageData"); + { + heif_context_free(heif_context); + ThrowReaderException(CorruptImageError,"UnableToReadImageData"); + } image_handle=(struct heif_image_handle *) NULL; error=heif_context_get_primary_image_handle(heif_context,&image_handle); if (error.code != 0) -- 2.40.0