From: Richard Underhill Date: Thu, 30 Jul 2015 08:34:20 +0000 (+0100) Subject: Stop memory leaks in FontClient. X-Git-Tag: dali_1.0.52~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F37%2F44937%2F3;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Stop memory leaks in FontClient. Change-Id: Iaa66eeb3ea1d4f454e17f704cd75a1183959f36b Signed-off-by: Richard Underhill --- diff --git a/text/dali/internal/text-abstraction/font-client-plugin-impl.cpp b/text/dali/internal/text-abstraction/font-client-plugin-impl.cpp index aa6908a..18a4feb 100644 --- a/text/dali/internal/text-abstraction/font-client-plugin-impl.cpp +++ b/text/dali/internal/text-abstraction/font-client-plugin-impl.cpp @@ -315,11 +315,15 @@ FontId FontClient::Plugin::FindDefaultFont( Character charcode, // Keep going unless we prefer a different (color) font if( !preferColor || foundColor ) { + FcPatternDestroy( match ); + FcPatternDestroy( pattern ); break; } } - } + FcPatternDestroy( match ); + FcPatternDestroy( pattern ); + } return fontId; } @@ -1023,16 +1027,22 @@ bool FontClient::Plugin::IsScalable( const FontFamily& fontFamily, const FontSty // match the pattern FcPattern* match = FcFontMatch( NULL /* use default configure */, fontFamilyPattern, &result ); + bool isScalable = true; if( match ) { // Get the path to the font file name. FontPath path; GetFcString( match, FC_FILE, path ); - return IsScalable( path ); + isScalable = IsScalable( path ); + } + else + { + DALI_LOG_ERROR( "FreeType Cannot check font: %s %s\n", fontFamily.c_str(), fontStyle.c_str() ); } - DALI_LOG_ERROR( "FreeType Cannot check font: %s %s\n", fontFamily.c_str(), fontStyle.c_str() ); - return true; + FcPatternDestroy( fontFamilyPattern ); + FcPatternDestroy( match ); + return isScalable; } void FontClient::Plugin::GetFixedSizes( const FontPath& path, Vector< PointSize26Dot6 >& sizes ) @@ -1078,9 +1088,14 @@ void FontClient::Plugin::GetFixedSizes( const FontFamily& fontFamily, // Get the path to the font file name. FontPath path; GetFcString( match, FC_FILE, path ); - return GetFixedSizes( path, sizes ); + GetFixedSizes( path, sizes ); + } + else + { + DALI_LOG_ERROR( "FreeType Cannot check font: %s %s\n", fontFamily.c_str(), fontStyle.c_str() ); } - DALI_LOG_ERROR( "FreeType Cannot check font: %s %s\n", fontFamily.c_str(), fontStyle.c_str() ); + FcPatternDestroy( match ); + FcPatternDestroy( fontFamilyPattern ); } } // namespace Internal