File ImageMagick-CVE-2017-15217.patch of Package ImageMagick.30956
diff --git a/coders/sgi.c b/coders/sgi.c
index e590ba84fc..e285a95e5d 100644
--- a/coders/sgi.c
+++ b/coders/sgi.c
@@ -652,7 +652,10 @@ static Image *ReadSGIImage(const ImageInfo *image_info,ExceptionInfo *exception)
Create grayscale map.
*/
if (AcquireImageColormap(image,image->colors) == MagickFalse)
- ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+ {
+ pixel_info=RelinquishVirtualMemory(pixel_info);
+ ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+ }
/*
Convert SGI image to PseudoClass pixel packets.
*/