Title: [158280] trunk/Source/WebCore
- Revision
- 158280
- Author
- [email protected]
- Date
- 2013-10-30 10:44:59 -0700 (Wed, 30 Oct 2013)
Log Message
Fix memory leaks in platform/image-encoders/JPEGImageEncoder.cpp
https://bugs.webkit.org/show_bug.cgi?id=118781
Patch by Liangjun Zeng <[email protected]> on 2013-10-30
Reviewed by Brent Fulgham.
We can find the function "jpeg_finish_compress" call the function "jpeg_abort" at the end.
And the comments of "jpeg_abort" is "Abort processing of a JPEG compression operation,
but don't destroy the object itself". (We can find these in the "jcapimin.c" of jpeg)
So the compression object destroy need be called.
No new tests because this doesn't change functionality.
* platform/image-encoders/JPEGImageEncoder.cpp:
(WebCore::compressRGBABigEndianToJPEG):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (158279 => 158280)
--- trunk/Source/WebCore/ChangeLog 2013-10-30 17:40:06 UTC (rev 158279)
+++ trunk/Source/WebCore/ChangeLog 2013-10-30 17:44:59 UTC (rev 158280)
@@ -1,3 +1,19 @@
+2013-10-30 Liangjun Zeng <[email protected]>
+
+ Fix memory leaks in platform/image-encoders/JPEGImageEncoder.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=118781
+
+ Reviewed by Brent Fulgham.
+
+ We can find the function "jpeg_finish_compress" call the function "jpeg_abort" at the end.
+ And the comments of "jpeg_abort" is "Abort processing of a JPEG compression operation,
+ but don't destroy the object itself". (We can find these in the "jcapimin.c" of jpeg)
+ So the compression object destroy need be called.
+ No new tests because this doesn't change functionality.
+
+ * platform/image-encoders/JPEGImageEncoder.cpp:
+ (WebCore::compressRGBABigEndianToJPEG):
+
2013-10-30 Antti Koivisto <[email protected]>
Add debug settings for simple line layout
Modified: trunk/Source/WebCore/platform/image-encoders/JPEGImageEncoder.cpp (158279 => 158280)
--- trunk/Source/WebCore/platform/image-encoders/JPEGImageEncoder.cpp 2013-10-30 17:40:06 UTC (rev 158279)
+++ trunk/Source/WebCore/platform/image-encoders/JPEGImageEncoder.cpp 2013-10-30 17:44:59 UTC (rev 158280)
@@ -111,8 +111,10 @@
// rowBuffer must be defined here so that its destructor is always called even when "setjmp" catches an error.
Vector<JSAMPLE, 600 * 3> rowBuffer;
- if (setjmp(err.m_setjmpBuffer))
+ if (setjmp(err.m_setjmpBuffer)) {
+ jpeg_destroy_compress(&compressData);
return false;
+ }
jpeg_start_compress(&compressData, TRUE);
rowBuffer.resize(compressData.image_width * 3);
@@ -132,6 +134,7 @@
}
jpeg_finish_compress(&compressData);
+ jpeg_destroy_compress(&compressData);
return true;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes