...
diff --git a/coders/tim.c b/coders/tim.c
index 7cc0ae1..851454f 100644
--- a/coders/tim.c
+++ b/coders/tim.c
@@ -201,7 +201,11 @@
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
count=ReadBlob(image,2*image->colors,tim_colormap);
if (count != (ssize_t) (2*image->colors))
- ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
+ {
+ tim_colormap=(unsigned char *) RelinquishMagickMemory(tim_colormap);
+ ThrowReaderException(CorruptImageError,
+ "InsufficientImageDataInFile");
+ }
p=tim_colormap;
for (i=0; i < (ssize_t) image->colors; i++)
{