another memory leak about reading corrupted pic, 6.7.9
Posted: 2012-09-27T03:11:02-07:00
hi magick,
I noticed that there is another memory leak about freeing the memory allocated by ExceptionInfo. When image->exception is thrown, the following DestroyExceptionInfo will not be executed, thus lead to the leak. I've checked the src code of 6.2.8 and this is right there. Should be you guys' typo.
By the way, there is another bug which I didn't figure out how to fix it. It's also a reading corrupted jpeg problem.
when GetCharacter() ends early(FillInputBuffer() => JPEGErrorHandler => longjmp(error_manager->error_recovery,1)), the memory allocated by profile is not freed. Wish you guys could fix this bug soon. If necessary, I can provide the problem pic which may helps you guys reproduce the bug. Thx!
I noticed that there is another memory leak about freeing the memory allocated by ExceptionInfo. When image->exception is thrown, the following DestroyExceptionInfo will not be executed, thus lead to the leak. I've checked the src code of 6.2.8 and this is right there. Should be you guys' typo.
Code: Select all
Index: Image.cpp
===================================================================
--- Image.cpp (revision 9453)
+++ Image.cpp (working copy)
@@ -1603,9 +1603,9 @@
}
replaceImage( image );
throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
if ( image )
throwException( image->exception );
- (void) DestroyExceptionInfo( &exceptionInfo );
}
// Read image of specified size into current object
@@ -1627,9 +1627,9 @@
blob_.length(), &exceptionInfo );
replaceImage( image );
throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
if ( image )
throwException( image->exception );
- (void) DestroyExceptionInfo( &exceptionInfo );
}
// Read image of specified size from in-memory BLOB
@@ -1702,9 +1702,9 @@
&exceptionInfo );
replaceImage( image );
throwException( exceptionInfo );
+ (void) DestroyExceptionInfo( &exceptionInfo );
if ( image )
throwException( image->exception );
- (void) DestroyExceptionInfo( &exceptionInfo );
}
Code: Select all
Index: coders/jpeg.c + 638
profile=BlobToStringInfo((const void *) NULL,length);
if (profile == (StringInfo *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
p=GetStringInfoDatum(profile);
for (i=0; i < (ssize_t) GetStringInfoLength(profile); i++)
*p++=(unsigned char) GetCharacter(jpeg_info);