]> granicus.if.org Git - imagemagick/commitdiff
Fixed memory leak in heif
authorAlex Gaynor <alex.gaynor@gmail.com>
Fri, 27 Apr 2018 20:26:36 +0000 (16:26 -0400)
committerDirk Lemstra <dlemstra@users.noreply.github.com>
Fri, 27 Apr 2018 20:46:45 +0000 (22:46 +0200)
coders/heic.c

index 8fa660782d1889ab5fbd4d43e0f21ffcdc49f204..f8481158540a3a1879c1fed58780c11d8f5df985 100644 (file)
@@ -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)