]> git.sesse.net Git - vlc/commitdiff
freetype: provide a proper fix to prevent ATS from crashing when searching for the...
authorFelix Paul Kühne <fkuehne@videolan.org>
Thu, 31 May 2012 12:54:12 +0000 (14:54 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Thu, 31 May 2012 13:03:10 +0000 (15:03 +0200)
modules/text_renderer/freetype.c

index a7c7afd30030b26837a78722bbab8eb2d78c99aa..660d4927dd39a2033ce22e801d968baced779163 100644 (file)
@@ -726,9 +726,8 @@ static char* MacLegacy_Select( filter_t *p_filter, const char* psz_fontname,
     cf_fontName = CFStringCreateWithCString( kCFAllocatorDefault, psz_fontname, kCFStringEncodingUTF8 );
 
     ats_font_id = ATSFontFindFromName( cf_fontName, kATSOptionFlagsIncludeDisabledMask );
-    CFRelease( cf_fontName );
 
-    if ( ats_font_id == 0xFFFFFFFFUL )
+    if ( ats_font_id == 0 || ats_font_id == 0xFFFFFFFFUL )
     {
         msg_Dbg( p_filter, "ATS couldn't find %s by name, checking family", psz_fontname );
         ats_font_id = ATSFontFamilyFindFromName( cf_fontName, kATSOptionFlagsDefault );
@@ -736,14 +735,11 @@ static char* MacLegacy_Select( filter_t *p_filter, const char* psz_fontname,
         if ( ats_font_id == 0 || ats_font_id == 0xFFFFFFFFUL )
         {
             msg_Err( p_filter, "ATS couldn't find either %s nor its family", psz_fontname );
+            CFRelease( cf_fontName );
             return NULL;
         }
     }
-    else if( ats_font_id == 0 )
-    {
-        msg_Err( p_filter, "ATS couldn't find %s by name, won't check family", psz_fontname );
-        return NULL;
-    }
+    CFRelease( cf_fontName );
 
     if ( noErr != ATSFontGetFileReference( ats_font_id, &ref ) )
     {