From 2e3e3f1d2a46fec03ee4681391d948edc172855f Mon Sep 17 00:00:00 2001
From: Cristy <urban-warrior@imagemagick.org>
Date: Wed, 11 Apr 2018 18:13:31 -0400
Subject: [PATCH] https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7562

---
 coders/caption.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/coders/caption.c b/coders/caption.c
index fb1e2fb97..9ae5fe29e 100644
--- a/coders/caption.c
+++ b/coders/caption.c
@@ -159,6 +159,7 @@ static Image *ReadCAPTIONImage(const ImageInfo *image_info,
   width=draw_info->pointsize*strlen(caption);
   if (AcquireMagickResource(WidthResource,width) == MagickFalse)
     {
+      caption=DestroyString(caption);
       draw_info=DestroyDrawInfo(draw_info);
       ThrowReaderException(ImageError,"WidthOrHeightExceedsLimit");
     }
-- 
2.40.0