summaryrefslogtreecommitdiffstats
path: root/webkit/glue/image_decoder.cc
diff options
context:
space:
mode:
authormpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-26 23:05:14 +0000
committermpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-26 23:05:14 +0000
commitb2bbc8f43385fe1b484788d304baadaae1887704 (patch)
tree3d3f1672812ea07732d95d81b9961b2091c52534 /webkit/glue/image_decoder.cc
parent4d34e2ef8022e6a7771c6f4cd171547fc4b60518 (diff)
downloadchromium_src-b2bbc8f43385fe1b484788d304baadaae1887704.zip
chromium_src-b2bbc8f43385fe1b484788d304baadaae1887704.tar.gz
chromium_src-b2bbc8f43385fe1b484788d304baadaae1887704.tar.bz2
Fix a leak in ImageDecoder::Decode.
BUG=12549 TEST=none Review URL: http://codereview.chromium.org/115793 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16941 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/image_decoder.cc')
-rw-r--r--webkit/glue/image_decoder.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/webkit/glue/image_decoder.cc b/webkit/glue/image_decoder.cc
index b486826..178ef9d 100644
--- a/webkit/glue/image_decoder.cc
+++ b/webkit/glue/image_decoder.cc
@@ -11,6 +11,7 @@
MSVC_PUSH_WARNING_LEVEL(0);
#if defined(OS_WIN) || defined(OS_LINUX)
#include "ImageSourceSkia.h"
+#include "NativeImageSkia.h"
#elif defined(OS_MACOSX)
#include "ImageSource.h"
#include "RetainPtr.h"
@@ -64,8 +65,11 @@ SkBitmap ImageDecoder::Decode(const unsigned char* data, size_t size) const {
return SkBitmap();
#if defined(OS_WIN) || defined(OS_LINUX)
- return *reinterpret_cast<SkBitmap*>(frame0);
+ SkBitmap retval = *reinterpret_cast<SkBitmap*>(frame0);
+ delete frame0;
+ return retval;
#elif defined(OS_MACOSX)
+ // TODO(port): should we delete frame0 like Linux/Windows do above?
// BitmapImage releases automatically, but we're bypassing it so we'll need
// to do the releasing.
RetainPtr<CGImageRef> image(AdoptCF, frame0);