From 9fc5c68823c7e39e4769a41713ce070a7780df29 Mon Sep 17 00:00:00 2001 From: "bungeman@google.com" Date: Tue, 12 Nov 2013 15:25:29 +0000 Subject: Fix leak detected in FontMgrMatchGM::onDraw by Valgrind. git-svn-id: http://skia.googlecode.com/svn/trunk@12242 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gm/fontmgr.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'gm') diff --git a/gm/fontmgr.cpp b/gm/fontmgr.cpp index 06288b2ab3..4b64821e7e 100644 --- a/gm/fontmgr.cpp +++ b/gm/fontmgr.cpp @@ -162,18 +162,16 @@ protected: "Helvetica Neue", "Arial" }; - SkFontStyleSet* fset = NULL; + SkAutoTUnref 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); -- cgit v1.2.3