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

Unified Diff: tests/ImageDecodingTest.cpp

Issue 1336763007: fix leak in test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageDecodingTest.cpp
diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp
index 160260d9c85eadfac4941f572d0b544b24e84dbf..c1ff39fa4e1e80f4bced140853a0c8f5fa00bb7b 100644
--- a/tests/ImageDecodingTest.cpp
+++ b/tests/ImageDecodingTest.cpp
@@ -502,18 +502,18 @@ static void test_options(skiatest::Reporter* reporter,
bool useData,
const SkString& path) {
SkBitmap bm;
- SkImageGenerator* gen;
+ SkAutoTDelete<SkImageGenerator> gen;
if (useData) {
if (nullptr == encodedData) {
return;
}
- gen = SkDecodingImageGenerator::Create(encodedData, opts);
+ gen.reset(SkDecodingImageGenerator::Create(encodedData, opts));
} else {
if (nullptr == encodedStream) {
return;
}
- gen = SkDecodingImageGenerator::Create(encodedStream->duplicate(), opts);
+ gen.reset(SkDecodingImageGenerator::Create(encodedStream->duplicate(), opts));
}
if (!gen) {
if (opts.fUseRequestedColorType && (kARGB_4444_SkColorType == opts.fRequestedColorType)) {
@@ -651,8 +651,8 @@ DEF_TEST(DecodingImageGenerator_ColorTableCheck, r) {
}
SkAutoDataUnref encoded(SkData::NewFromFileName(path.c_str()));
SkBitmap bitmap;
- SkImageGenerator* gen = SkDecodingImageGenerator::Create(encoded,
- SkDecodingImageGenerator::Options());
+ SkAutoTDelete<SkImageGenerator> gen(SkDecodingImageGenerator::Create(encoded,
+ SkDecodingImageGenerator::Options()));
if (!gen) {
REPORTER_ASSERT(r, false);
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698