fix memory leak
fix memory leak
diff --git a/coders/tim.c b/coders/tim.c
index 7f87292..32af8e2 100644
--- a/coders/tim.c
+++ b/coders/tim.c
@@ -240,7 +240,10 @@
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
count=ReadBlob(image,image_size,tim_data);
if (count != (ssize_t) (image_size))
- ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
+ {
+ tim_data=(unsigned char *) RelinquishMagickMemory(tim_data);
+ ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
+ }
tim_pixels=tim_data;
/*
Initialize image structure.
@@ -383,7 +386,10 @@
break;
}
default:
- ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+ {
+ tim_data=(unsigned char *) RelinquishMagickMemory(tim_data);
+ ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+ }
}
if (image->storage_class == PseudoClass)
(void) SyncImage(image,exception);