# HG changeset patch # User Eric Warmenhoven # Date 994187328 0 # Node ID 3914400226978ea3970d37df8f5abb8036d1fcfc # Parent 1f51e772a05cd078339ba158544eba8eb7b57d80 [gaim-migrate @ 2075] minor one-time leak committer: Tailor Script diff -r 1f51e772a05c -r 391440022697 src/gtkimhtml.c --- a/src/gtkimhtml.c Thu Jun 28 19:53:48 2001 +0000 +++ b/src/gtkimhtml.c Tue Jul 03 19:08:48 2001 +0000 @@ -1541,12 +1541,19 @@ get_font_names () { gint num_fonts = 0; - gchar **xfontnames = XListFonts (GDK_DISPLAY (), "-*", MAX_FONTS, &num_fonts); - gchar **fonts = NULL; + gchar **xfontnames; + static gchar **fonts = NULL; gint i; - if (!num_fonts) + if (fonts) + return fonts; + + xfontnames = XListFonts (GDK_DISPLAY (), "-*", MAX_FONTS, &num_fonts); + + if (!num_fonts) { + XFreeFontNames(xfontnames); return g_new0 (char *, 1); + } fonts = g_new0 (char *, num_fonts + 1); @@ -1566,6 +1573,7 @@ fonts [i] = g_strndup (t1, (long) t2 - (long) t1); } + XFreeFontNames(xfontnames); return fonts; }