| Index: src/codec/SkCodec_libbmp.cpp
|
| diff --git a/src/codec/SkCodec_libbmp.cpp b/src/codec/SkCodec_libbmp.cpp
|
| index 75c5715bda1df787b6e503c3346a1a172590bde7..2b20faebad050c9d67a3769edc147f247c5e6ac3 100644
|
| --- a/src/codec/SkCodec_libbmp.cpp
|
| +++ b/src/codec/SkCodec_libbmp.cpp
|
| @@ -108,6 +108,7 @@ SkCodec* SkBmpCodec::NewFromIco(SkStream* stream) {
|
| * Read enough of the stream to initialize the SkBmpCodec. Returns a bool
|
| * representing success or failure. If it returned true, and codecOut was
|
| * not NULL, it will be set to a new SkBmpCodec.
|
| + * Does *not* take ownership of the passed in SkStream.
|
| *
|
| */
|
| bool SkBmpCodec::ReadHeader(SkStream* stream, bool isIco, SkCodec** codecOut) {
|
| @@ -496,8 +497,13 @@ bool SkBmpCodec::ReadHeader(SkStream* stream, bool isIco, SkCodec** codecOut) {
|
| *
|
| */
|
| SkCodec* SkBmpCodec::NewFromStream(SkStream* stream, bool isIco) {
|
| + SkAutoTDelete<SkStream> streamDeleter(stream);
|
| SkCodec* codec = NULL;
|
| if (ReadHeader(stream, isIco, &codec)) {
|
| + // codec has taken ownership of stream, so we do not need to
|
| + // delete it.
|
| + SkASSERT(codec);
|
| + streamDeleter.detach();
|
| return codec;
|
| }
|
| return NULL;
|
|
|