diff options
author | Liangjun Zeng <lizeng@blackberry.com> | 2014-02-07 15:28:39 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-07 17:05:15 +0100 |
commit | 386fbb8ccd02af90ddec81fb1730876c18b07099 (patch) | |
tree | 4843f464788562fa9ae3d54ef61aa9856e2952e7 | |
parent | 6838f67f34b601640e4dd94d9081956f8b2d83e5 (diff) |
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):
Change-Id: Ic58b53c4e6bada7e92e09825be9e770f1c5445c1
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158280 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
-rw-r--r-- | Source/WebCore/platform/image-encoders/JPEGImageEncoder.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/WebCore/platform/image-encoders/JPEGImageEncoder.cpp b/Source/WebCore/platform/image-encoders/JPEGImageEncoder.cpp index ac157b8f7..d202388da 100644 --- a/Source/WebCore/platform/image-encoders/JPEGImageEncoder.cpp +++ b/Source/WebCore/platform/image-encoders/JPEGImageEncoder.cpp @@ -111,8 +111,10 @@ bool compressRGBABigEndianToJPEG(unsigned char* rgbaBigEndianData, const IntSize // 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 @@ bool compressRGBABigEndianToJPEG(unsigned char* rgbaBigEndianData, const IntSize } jpeg_finish_compress(&compressData); + jpeg_destroy_compress(&compressData); return true; } |