diff options
author | 3 <alexl@redhat.com> | 2001-01-23 11:25:52 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2001-01-23 11:25:52 +0000 |
commit | ff7d31690c238cfdf8ed7d071cd34621a2dd7bb2 (patch) | |
tree | 9fc3d74df173e73c7315610731d93d4ece0df9e0 /pango | |
parent | f685b8e639f4c28c49be358b62f85d0ccfa1415f (diff) | |
download | pango-ff7d31690c238cfdf8ed7d071cd34621a2dd7bb2.tar.gz |
Don't leak PangoCoverage. Move name free closer to allocation.
2001-01-23 <alexl@redhat.com>
* modules/basic/basic-ft2.c (basic_engine_get_coverage):
Don't leak PangoCoverage.
* pango/pangoft2-fontmap.c (pango_ft2_font_map_load_font):
Move name free closer to allocation.
(pango_ft2_font_map_read_alias_file): Don't leak faces.
(pango_ft2_font_entry_get_coverage): Don't leak font as
filename and cache_file_name.
Diffstat (limited to 'pango')
-rw-r--r-- | pango/pangoft2-fontmap.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pango/pangoft2-fontmap.c b/pango/pangoft2-fontmap.c index 6728361c..fab370d0 100644 --- a/pango/pangoft2-fontmap.c +++ b/pango/pangoft2-fontmap.c @@ -520,6 +520,8 @@ pango_ft2_font_map_load_font (PangoFontMap *fontmap, g_strdown (name); family_entry = g_hash_table_lookup (ft2fontmap->families, name); + g_free (name); + if (family_entry) { PangoFT2FontEntry *best_match = NULL; @@ -583,7 +585,6 @@ pango_ft2_font_map_load_font (PangoFontMap *fontmap, } } - g_free (name); return result; } @@ -686,6 +687,8 @@ pango_ft2_font_map_read_alias_file (PangoFT2FontMap *ft2fontmap, } } + g_strfreev (faces); + /* Insert the font entry into our structures */ family_entry = pango_ft2_get_family_entry (ft2fontmap, font_entry->description.family_name); @@ -941,6 +944,7 @@ pango_ft2_font_entry_get_coverage (PangoFT2FontEntry *entry, PangoFontDescription *description; FILE *cache_file; gchar *cache_file_name; + gchar *font_as_filename; guchar *buf; int buflen; @@ -952,12 +956,14 @@ pango_ft2_font_entry_get_coverage (PangoFT2FontEntry *entry, } description = pango_font_describe (font); + font_as_filename = pango_font_description_to_filename (description); cache_file_name = g_strconcat (pango_get_sysconf_subdirectory (), G_DIR_SEPARATOR_S "cache.ft2" G_DIR_SEPARATOR_S, - pango_font_description_to_filename (description), + font_as_filename, ".", lang ? lang : "", NULL); + g_free (font_as_filename); pango_font_description_free (description); PING (("trying to load %s", cache_file_name)); @@ -1008,7 +1014,6 @@ pango_ft2_font_entry_get_coverage (PangoFT2FontEntry *entry, PING (("saving %d bytes to %s", buflen, cache_file_name)); fwrite (buf, buflen, 1, cache_file); fclose (cache_file); - g_free (cache_file_name); g_free (buf); } } @@ -1019,6 +1024,8 @@ pango_ft2_font_entry_get_coverage (PangoFT2FontEntry *entry, pango_coverage_ref (result); } + g_free (cache_file_name); + return result; } |