Commit 1c7763266 for imagemagick.org
commit 1c7763266cfedc635005a965169bc2ddcc650221
Author: Cristy <urban-warrior@imagemagick.org>
Date: Tue Sep 22 07:05:21 2026 -0400
https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-w68r-6fmr-cvg4
diff --git a/coders/gif.c b/coders/gif.c
index 48f8ba7af..557963644 100644
--- a/coders/gif.c
+++ b/coders/gif.c
@@ -1653,7 +1653,13 @@ static MagickBooleanType WriteGIFImage(const ImageInfo *image_info,Image *image,
}
}
if ((image->storage_class == DirectClass) || (image->colors > 256))
- ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
+ {
+ global_colormap=(unsigned char *) RelinquishMagickMemory(
+ global_colormap);
+ colormap=(unsigned char *) RelinquishMagickMemory(colormap);
+ write_info=DestroyImageInfo(write_info);
+ ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
+ }
for (bits_per_pixel=1; bits_per_pixel < 8; bits_per_pixel++)
if ((one << bits_per_pixel) >= image->colors)
break;