Don't leak the keyfile parser in the error case.

2006-03-31  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkicontheme.c (load_icon_data): Don't leak the keyfile
	parser in the error case.

	* gtk/gtkicontheme.c (load_icon_data, free_unthemed_icon)
	(icon_data_free, load_themes):
	* gtk/gtkiconcache.c (_gtk_icon_cache_get_icon_data): Use the slice
	allocator for GtkIconData and UnthemedIcon structs.
This commit is contained in:
Matthias Clasen 2006-03-31 05:17:56 +00:00 committed by Matthias Clasen
parent 1d4c765db0
commit 082d4176d5
4 changed files with 42 additions and 21 deletions

View File

@ -1,3 +1,13 @@
2006-03-31 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkicontheme.c (load_icon_data): Don't leak the keyfile
parser in the error case.
* gtk/gtkicontheme.c (load_icon_data, free_unthemed_icon)
(icon_data_free, load_themes):
* gtk/gtkiconcache.c (_gtk_icon_cache_get_icon_data): Use the slice
allocator for GtkIconData and UnthemedIcon structs.
2006-03-30 Behdad Esfahbod <behdad@gnome.org>
* gtk/gtkcalendar.c: Fix translation comments for localizable

View File

@ -1,3 +1,13 @@
2006-03-31 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkicontheme.c (load_icon_data): Don't leak the keyfile
parser in the error case.
* gtk/gtkicontheme.c (load_icon_data, free_unthemed_icon)
(icon_data_free, load_themes):
* gtk/gtkiconcache.c (_gtk_icon_cache_get_icon_data): Use the slice
allocator for GtkIconData and UnthemedIcon structs.
2006-03-30 Behdad Esfahbod <behdad@gnome.org>
* gtk/gtkcalendar.c: Fix translation comments for localizable

View File

@ -489,7 +489,7 @@ _gtk_icon_cache_get_icon_data (GtkIconCache *cache,
if (!meta_data_offset)
return NULL;
data = g_new0 (GtkIconData, 1);
data = g_slice_new0 (GtkIconData);
offset = GET_UINT32 (cache->buffer, meta_data_offset);
if (offset)

View File

@ -70,13 +70,14 @@ struct _GtkIconThemePrivate
guint custom_theme : 1;
guint is_screen_singleton : 1;
guint pixbuf_supports_svg : 1;
guint themes_valid : 1;
guint check_reload : 1;
char *current_theme;
char *fallback_theme;
char **search_path;
int search_path_len;
gboolean themes_valid;
/* A list of all the themes needed to look up icons.
* In search order, without duplicates
*/
@ -97,8 +98,6 @@ struct _GtkIconThemePrivate
GList *dir_mtimes;
gulong reset_styles_idle;
gboolean check_reload;
};
struct _GtkIconInfo
@ -1019,7 +1018,7 @@ free_unthemed_icon (UnthemedIcon *unthemed_icon)
g_free (unthemed_icon->svg_filename);
if (unthemed_icon->no_svg_filename)
g_free (unthemed_icon->no_svg_filename);
g_free (unthemed_icon);
g_slice_free (UnthemedIcon, unthemed_icon);
}
static void
@ -1120,7 +1119,7 @@ load_themes (GtkIconTheme *icon_theme)
}
else
{
unthemed_icon = g_new0 (UnthemedIcon, 1);
unthemed_icon = g_slice_new0 (UnthemedIcon);
if (new_suffix == ICON_SUFFIX_SVG)
unthemed_icon->svg_filename = abs_file;
@ -2093,6 +2092,7 @@ load_icon_data (IconThemeDir *dir, const char *path, const char *name)
if (error)
{
g_error_free (error);
g_key_file_free (icon_file);
return;
}
else
@ -2101,7 +2101,7 @@ load_icon_data (IconThemeDir *dir, const char *path, const char *name)
dot = strrchr (base_name, '.');
*dot = 0;
data = g_new0 (GtkIconData, 1);
data = g_slice_new0 (GtkIconData);
g_hash_table_replace (dir->icon_data, base_name, data);
ivalues = g_key_file_get_integer_list (icon_file,
@ -2127,7 +2127,7 @@ load_icon_data (IconThemeDir *dir, const char *path, const char *name)
split = g_strsplit (str, "|", -1);
data->n_attach_points = g_strv_length (split);
data->attach_points = g_malloc (sizeof (GdkPoint) * data->n_attach_points);
data->attach_points = g_new (GdkPoint, data->n_attach_points);
i = 0;
while (split[i] != NULL && i < data->n_attach_points)
@ -2333,7 +2333,7 @@ icon_data_free (GtkIconData *icon_data)
{
g_free (icon_data->attach_points);
g_free (icon_data->display_name);
g_free (icon_data);
g_slice_free (GtkIconData, icon_data);
}
/*
@ -2349,13 +2349,14 @@ gtk_icon_info_get_type (void)
(GBoxedCopyFunc) gtk_icon_info_copy,
(GBoxedFreeFunc) gtk_icon_info_free);
return our_type;
}
static GtkIconInfo *
icon_info_new (void)
{
GtkIconInfo *icon_info = g_new0 (GtkIconInfo, 1);
GtkIconInfo *icon_info = g_slice_new0 (GtkIconInfo);
icon_info->scale = -1.;
@ -2392,7 +2393,7 @@ gtk_icon_info_copy (GtkIconInfo *icon_info)
g_return_val_if_fail (icon_info != NULL, NULL);
copy = g_memdup (icon_info, sizeof (GtkIconInfo));
copy = memcpy (g_slice_new (GtkIconInfo), icon_info, sizeof (GtkIconInfo));
if (copy->cache_pixbuf)
g_object_ref (copy->cache_pixbuf);
if (copy->pixbuf)
@ -2433,7 +2434,7 @@ gtk_icon_info_free (GtkIconInfo *icon_info)
if (icon_info->cache_pixbuf)
g_object_unref (icon_info->cache_pixbuf);
g_free (icon_info);
g_slice_free (GtkIconInfo, icon_info);
}
/**