From 88d87e23a782c761f8cf301dee98ff04156a8611 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Mon, 27 Aug 2018 07:23:44 +0200 Subject: [PATCH] Added missing memory checks. --- coders/heic.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/coders/heic.c b/coders/heic.c index 2f2bd9b89..419ca9845 100644 --- a/coders/heic.c +++ b/coders/heic.c @@ -228,16 +228,23 @@ static Image *ReadHEICImage(const ImageInfo *image_info, "InsufficientImageDataInFile"); } exif_buffer=AcquireMagickMemory(exif_size); - error=heif_image_handle_get_metadata(image_handle,exif_id,exif_buffer); - if (error.code == 0) + if (exif_buffer != NULL) { - StringInfo - *profile; + error=heif_image_handle_get_metadata(image_handle, + exif_id,exif_buffer); + if (error.code == 0) + { + StringInfo + *profile; - profile=BlobToStringInfo(exif_buffer,exif_size); - SetImageProfile(image,"exif",profile,exception); - profile=DestroyStringInfo(profile); - } + profile=BlobToStringInfo(exif_buffer,exif_size); + if (profile != (StringInfo*) NULL) + { + SetImageProfile(image,"exif",profile,exception); + profile=DestroyStringInfo(profile); + } + } + } exif_buffer=RelinquishMagickMemory(exif_buffer); } /* -- 2.40.0