Commit e6394098a for imagemagick.org
commit e6394098af39a9689bb5f0b4eb6a9968e449a8d3
Author: Dirk Lemstra <dirk@lemstra.org>
Date: Fri Feb 6 22:37:42 2026 +0100
Fixed possible memory leak (GHSA-3q5f-gmjc-38r8)
diff --git a/coders/txt.c b/coders/txt.c
index 06825fb06..dc99215f9 100644
--- a/coders/txt.c
+++ b/coders/txt.c
@@ -272,6 +272,7 @@ static Image *ReadTEXTImage(const ImageInfo *image_info,
if (status == MagickFalse)
{
draw_info=DestroyDrawInfo(draw_info);
+ texture=DestroyImageList(texture);
ThrowReaderException(TypeError,"UnableToGetTypeMetrics");
}
page.y=CastDoubleToSsizeT(ceil((double) page.y+metrics.ascent-0.5));
@@ -346,8 +347,7 @@ static Image *ReadTEXTImage(const ImageInfo *image_info,
(void) SetImageProgressMonitor(image,progress_monitor,image->client_data);
}
(void) AnnotateImage(image,draw_info,exception);
- if (texture != (Image *) NULL)
- texture=DestroyImageList(texture);
+ texture=DestroyImageList(texture);
draw_info=DestroyDrawInfo(draw_info);
if (CloseBlob(image) == MagickFalse)
status=MagickFalse;