fix leak in test
BUG=skia:4335 Review URL: https://codereview.chromium.org/1336763007
This commit is contained in:
parent
995b4bddd9
commit
8725e5366b
@ -502,18 +502,18 @@ static void test_options(skiatest::Reporter* reporter,
|
|||||||
bool useData,
|
bool useData,
|
||||||
const SkString& path) {
|
const SkString& path) {
|
||||||
SkBitmap bm;
|
SkBitmap bm;
|
||||||
SkImageGenerator* gen;
|
SkAutoTDelete<SkImageGenerator> gen;
|
||||||
|
|
||||||
if (useData) {
|
if (useData) {
|
||||||
if (nullptr == encodedData) {
|
if (nullptr == encodedData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gen = SkDecodingImageGenerator::Create(encodedData, opts);
|
gen.reset(SkDecodingImageGenerator::Create(encodedData, opts));
|
||||||
} else {
|
} else {
|
||||||
if (nullptr == encodedStream) {
|
if (nullptr == encodedStream) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gen = SkDecodingImageGenerator::Create(encodedStream->duplicate(), opts);
|
gen.reset(SkDecodingImageGenerator::Create(encodedStream->duplicate(), opts));
|
||||||
}
|
}
|
||||||
if (!gen) {
|
if (!gen) {
|
||||||
if (opts.fUseRequestedColorType && (kARGB_4444_SkColorType == opts.fRequestedColorType)) {
|
if (opts.fUseRequestedColorType && (kARGB_4444_SkColorType == opts.fRequestedColorType)) {
|
||||||
@ -651,8 +651,8 @@ DEF_TEST(DecodingImageGenerator_ColorTableCheck, r) {
|
|||||||
}
|
}
|
||||||
SkAutoDataUnref encoded(SkData::NewFromFileName(path.c_str()));
|
SkAutoDataUnref encoded(SkData::NewFromFileName(path.c_str()));
|
||||||
SkBitmap bitmap;
|
SkBitmap bitmap;
|
||||||
SkImageGenerator* gen = SkDecodingImageGenerator::Create(encoded,
|
SkAutoTDelete<SkImageGenerator> gen(SkDecodingImageGenerator::Create(encoded,
|
||||||
SkDecodingImageGenerator::Options());
|
SkDecodingImageGenerator::Options()));
|
||||||
if (!gen) {
|
if (!gen) {
|
||||||
REPORTER_ASSERT(r, false);
|
REPORTER_ASSERT(r, false);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user