scanline=(unsigned char *) AcquireQuantumMemory(iris_info.columns,
bytes_per_pixel*sizeof(*scanline));
if (scanline == (unsigned char *) NULL)
- ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+ {
+ pixel_info=RelinquishVirtualMemory(pixel_info);
+ ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+ }
for (z=0; z < (ssize_t) iris_info.depth; z++)
{
p=pixels+bytes_per_pixel*z;
(runlength == (size_t *) NULL) ||
(packet_info == (MemoryInfo *) NULL))
{
- if (offsets == (ssize_t *) NULL)
- offsets=(ssize_t *) RelinquishMagickMemory(offsets);
- if (runlength == (size_t *) NULL)
- runlength=(size_t *) RelinquishMagickMemory(runlength);
- if (packet_info == (MemoryInfo *) NULL)
+ offsets=(ssize_t *) RelinquishMagickMemory(offsets);
+ runlength=(size_t *) RelinquishMagickMemory(runlength);
+ if (packet_info != (MemoryInfo *) NULL)
packet_info=RelinquishVirtualMemory(packet_info);
+ pixel_info=RelinquishVirtualMemory(pixel_info);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
packets=(unsigned char *) GetVirtualMemoryBlob(packet_info);
{
runlength[i]=ReadBlobMSBLong(image);
if (runlength[i] > (4*(size_t) iris_info.columns+10))
- ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+ {
+ packet_info=RelinquishVirtualMemory(packet_info);
+ runlength=(size_t *) RelinquishMagickMemory(runlength);
+ offsets=(ssize_t *) RelinquishMagickMemory(offsets);
+ pixel_info=RelinquishVirtualMemory(pixel_info);
+ ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+ }
}
/*
Check data order.
(runlength[y+z*iris_info.rows]/bytes_per_pixel),packets,
(ssize_t) iris_info.columns,p+bytes_per_pixel*z);
if (status == MagickFalse)
- ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+ {
+ packet_info=RelinquishVirtualMemory(packet_info);
+ runlength=(size_t *) RelinquishMagickMemory(runlength);
+ offsets=(ssize_t *) RelinquishMagickMemory(offsets);
+ pixel_info=RelinquishVirtualMemory(pixel_info);
+ ThrowReaderException(CorruptImageError,
+ "ImproperImageHeader");
+ }
p+=(iris_info.columns*4*bytes_per_pixel);
}
}
(runlength[y+z*iris_info.rows]/bytes_per_pixel),packets,
(ssize_t) iris_info.columns,p+bytes_per_pixel*z);
if (status == MagickFalse)
- ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+ {
+ packet_info=RelinquishVirtualMemory(packet_info);
+ runlength=(size_t *) RelinquishMagickMemory(runlength);
+ offsets=(ssize_t *) RelinquishMagickMemory(offsets);
+ pixel_info=RelinquishVirtualMemory(pixel_info);
+ ThrowReaderException(CorruptImageError,
+ "ImproperImageHeader");
+ }
}
p+=(iris_info.columns*4*bytes_per_pixel);
}