Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/codec/SkCodec_wbmp.cpp

Issue 1058873006: Get rid of leaks in SkCodec::NewFromStream. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comment that ReadHeader does not own SkStream. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/codec/SkCodec_libpng.cpp ('k') | tests/CodexTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkCodec.h" 8 #include "SkCodec.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkStream.h" 10 #include "SkStream.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 dst += rowBytes; 147 dst += rowBytes;
148 } 148 }
149 return SkImageGenerator::kSuccess; 149 return SkImageGenerator::kSuccess;
150 } 150 }
151 151
152 bool SkWbmpCodec::IsWbmp(SkStream* stream) { 152 bool SkWbmpCodec::IsWbmp(SkStream* stream) {
153 return read_header(stream, NULL); 153 return read_header(stream, NULL);
154 } 154 }
155 155
156 SkCodec* SkWbmpCodec::NewFromStream(SkStream* stream) { 156 SkCodec* SkWbmpCodec::NewFromStream(SkStream* stream) {
157 SkAutoTDelete<SkStream> streamDeleter(stream);
157 SkISize size; 158 SkISize size;
158 if (!read_header(stream, &size)) { 159 if (!read_header(stream, &size)) {
159 return NULL; 160 return NULL;
160 } 161 }
161 SkImageInfo info = 162 SkImageInfo info =
162 SkImageInfo::Make(size.width(), size.height(), kGray_8_SkColorType, 163 SkImageInfo::Make(size.width(), size.height(), kGray_8_SkColorType,
163 kOpaque_SkAlphaType); 164 kOpaque_SkAlphaType);
164 return SkNEW_ARGS(SkWbmpCodec, (info, stream)); 165 return SkNEW_ARGS(SkWbmpCodec, (info, streamDeleter.detach()));
165 } 166 }
OLDNEW
« no previous file with comments | « src/codec/SkCodec_libpng.cpp ('k') | tests/CodexTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698