Fix WebPImageDecoder decoder leak.
authornoel.gordon@gmail.com <noel.gordon@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 4 Dec 2011 06:46:06 +0000 (06:46 +0000)
committernoel.gordon@gmail.com <noel.gordon@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 4 Dec 2011 06:46:06 +0000 (06:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=73756

Reviewed by Andreas Kling.

Delete the m_decoder member in the destructor if needed with WebPIDelete.

No new tests, it's valgrind territory.

* platform/image-decoders/webp/WEBPImageDecoder.cpp:
(WebCore::WEBPImageDecoder::~WEBPImageDecoder):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@101948 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/image-decoders/webp/WEBPImageDecoder.cpp

index 79a5080..2fb9585 100644 (file)
@@ -1,3 +1,17 @@
+2011-12-03  Noel Gordon  <noel.gordon@gmail.com>
+
+        Fix WebPImageDecoder decoder leak.
+        https://bugs.webkit.org/show_bug.cgi?id=73756
+
+        Reviewed by Andreas Kling.
+
+        Delete the m_decoder member in the destructor if needed with WebPIDelete.
+
+        No new tests, it's valgrind territory.
+
+        * platform/image-decoders/webp/WEBPImageDecoder.cpp:
+        (WebCore::WEBPImageDecoder::~WEBPImageDecoder):
+
 2011-12-03  Andreas Kling  <kling@webkit.org>
 
         CSSStyleSheet: Parent rule can only ever be @import, enforce this at compile time.
index eacfd29..4cda81d 100644 (file)
@@ -45,6 +45,9 @@ WEBPImageDecoder::WEBPImageDecoder(ImageSource::AlphaOption alphaOption,
 
 WEBPImageDecoder::~WEBPImageDecoder()
 {
+    if (m_decoder)
+        WebPIDelete(m_decoder);
+    m_decoder = 0;
 }
 
 bool WEBPImageDecoder::isSizeAvailable()