Fix leak detected in FontMgrMatchGM::onDraw by Valgrind.
git-svn-id: http://skia.googlecode.com/svn/trunk@12242 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/fontmgr.cpp b/gm/fontmgr.cpp
index 06288b2..4b64821 100644
--- a/gm/fontmgr.cpp
+++ b/gm/fontmgr.cpp
@@ -162,18 +162,16 @@
"Helvetica Neue", "Arial"
};
- SkFontStyleSet* fset = NULL;
+ SkAutoTUnref<SkFontStyleSet> fset;
for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); ++i) {
- fset = fFM->matchFamily(gNames[i]);
- if (fset && fset->count() > 0) {
+ fset.reset(fFM->matchFamily(gNames[i]));
+ if (fset->count() > 0) {
break;
}
}
-
- if (NULL == fset) {
+ if (NULL == fset.get()) {
return;
}
- SkAutoUnref aur(fset);
canvas->translate(20, 40);
this->exploreFamily(canvas, paint, fset);