Fix leak in SkImage_Gpu::onMakeSubset().
BUG=skia:5327
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2003573002
Review-Url: https://codereview.chromium.org/2003573002
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 2c24058..f026ebc 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -140,13 +140,13 @@
desc.fWidth = subset.width();
desc.fHeight = subset.height();
- GrTexture* subTx = ctx->textureProvider()->createTexture(desc, fBudgeted);
+ sk_sp<GrTexture> subTx(ctx->textureProvider()->createTexture(desc, fBudgeted));
if (!subTx) {
return nullptr;
}
- ctx->copySurface(subTx, fTexture, subset, SkIPoint::Make(0, 0));
+ ctx->copySurface(subTx.get(), fTexture, subset, SkIPoint::Make(0, 0));
return sk_make_sp<SkImage_Gpu>(desc.fWidth, desc.fHeight, kNeedNewImageUniqueID,
- fAlphaType, subTx, fBudgeted);
+ fAlphaType, subTx.get(), fBudgeted);
}
///////////////////////////////////////////////////////////////////////////////////////////////////