Commit d11096437 for imagemagick.org
commit d11096437216985db2fcad23c31be2b3e9644a25
Author: Cristy <urban-warrior@imagemagick.org>
Date: Thu Jul 9 20:13:14 2026 -0400
premature reconstruct destruction
diff --git a/MagickCore/compare.c b/MagickCore/compare.c
index b6c611c6f..d0a1c8d47 100644
--- a/MagickCore/compare.c
+++ b/MagickCore/compare.c
@@ -4101,11 +4101,14 @@ static Image *MSESimilarityImage(const Image *image,const Image *reconstruct,
(void) CompositeImage(reconstruct_image,reconstruct,CopyCompositeOp,
MagickTrue,0,0,exception);
beta_image=SIMCrossCorrelationImage(image,reconstruct_image,exception);
- reconstruct_image=DestroyImage(reconstruct_image);
if (beta_image == (Image *) NULL)
- ThrowMSESimilarityException();
+ {
+ reconstruct_image=DestroyImage(reconstruct_image);
+ ThrowMSESimilarityException();
+ }
status=SIMMultiplyImage(beta_image,-2.0/reconstruct->columns/(double)
reconstruct->rows,(const ChannelStatistics *) NULL,exception);
+ reconstruct_image=DestroyImage(reconstruct_image);
if (status == MagickFalse)
ThrowMSESimilarityException();
/*