Bug 55590 - Improper use of pango_language_matches() in GTK+ plugin
Summary: Improper use of pango_language_matches() in GTK+ plugin
Status: RESOLVED FIXED
Alias: None
Product: PackageKit
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Richard Hughes
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-03 19:35 UTC by Owen Taylor
Modified: 2015-01-15 17:12 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Patching fixing bug (1.20 KB, patch)
2012-10-03 19:41 UTC, Owen Taylor
Details | Splinter Review

Description Owen Taylor 2012-10-03 19:35:06 UTC
See https://bugzilla.redhat.com/show_bug.cgi?id=862161


commit 677e8ab4086208f06b988d98b247aeb53e554638
Author: William Jon McCann <jmccann@redhat.com>
Date:   Tue Sep 11 00:21:34 2012 -0400

    Don't leak pango languages
    
    Signed-off-by: Richard Hughes <richard@hughsie.com>

diff --git a/contrib/gtk-module/pk-gtk-module.c b/contrib/gtk-module/pk-gtk-module.c
index 8145848..2c93f02 100644
--- a/contrib/gtk-module/pk-gtk-module.c
+++ b/contrib/gtk-module/pk-gtk-module.c
@@ -252,8 +252,7 @@ pk_pango_fc_font_map_load_fontset (PangoFontMap *font_map,
         * code instead of "xx"... */
        if (G_LIKELY (language == last_language) ||
            language == NULL ||
-           language == pango_language_from_string ("C") ||
-           language == pango_language_from_string ("xx"))
+           pango_language_matches (language, "C;xx"))
                return fontset;
 
        if (G_UNLIKELY (!seen_languages))

The old code didn't leak - pango_language_from_string() doesn't return memory that needs to be free - and the new code doesn't work since it would have to be:

 pango_language_matches (language, "c;xx")

to work - pango_language_matches() doesn't canonicalize the pattern.
Comment 1 Owen Taylor 2012-10-03 19:41:35 UTC
Created attachment 68053 [details] [review]
Patching fixing bug
Comment 2 Richard Hughes 2012-10-03 21:49:50 UTC
Pushed to master, thanks!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.