Index: src/images/SkImageDecoder_libjpeg.cpp |
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp |
index 8c9d26783ca40c82ab4be6ae7d5fc0569d2bdf65..e0722e18dc60972719d2634fa06c48dd58070b4e 100644 |
--- a/src/images/SkImageDecoder_libjpeg.cpp |
+++ b/src/images/SkImageDecoder_libjpeg.cpp |
@@ -105,8 +105,10 @@ static void initialize_info(jpeg_decompress_struct* cinfo, skjpeg_source_mgr* sr |
#ifdef SK_BUILD_FOR_ANDROID |
class SkJPEGImageIndex { |
public: |
+ // Takes ownership of stream. |
SkJPEGImageIndex(SkStreamRewindable* stream, SkImageDecoder* decoder) |
: fSrcMgr(stream, decoder) |
+ , fStream(stream) |
, fInfoInitialized(false) |
, fHuffmanCreated(false) |
, fDecompressStarted(false) |
@@ -206,6 +208,7 @@ public: |
private: |
skjpeg_source_mgr fSrcMgr; |
+ SkAutoTDelete<SkStream> fStream; |
jpeg_decompress_struct fCInfo; |
huffman_index fHuffmanIndex; |
bool fInfoInitialized; |