From f7b21ce271b04e25a8e59f51c4222c5418271a09 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Sun, 4 Mar 2018 21:20:08 +0100 Subject: [PATCH] Fixed memory leak (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5804) --- MagickCore/montage.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MagickCore/montage.c b/MagickCore/montage.c index 2e0b92e9b..5e8d647f7 100644 --- a/MagickCore/montage.c +++ b/MagickCore/montage.c @@ -438,6 +438,8 @@ MagickExport Image *MontageImageList(const ImageInfo *image_info, } if (i < (ssize_t) number_images) { + if (image != (Image *) NULL) + image=DestroyImage(image); if (thumbnail == (Image *) NULL) i--; for (tile=0; (ssize_t) tile <= i; tile++) -- 2.40.0