don't leak icon_name.

2008-11-18  Rodrigo Moya <rodrigo@gnome-db.org>

	* font-viewer/font-view.c (set_icon): don't leak icon_name.

	* font-viewer/ftstream-vfs.c (vfs_stream_open): don't leak
	GFile pointer.

svn path=/trunk/; revision=9143
This commit is contained in:
Rodrigo Moya 2008-11-18 17:59:38 +00:00 committed by Rodrigo Moya
parent 8cff6042ab
commit afbe70bca0
3 changed files with 22 additions and 14 deletions

View file

@ -1,3 +1,10 @@
2008-11-18 Rodrigo Moya <rodrigo@gnome-db.org>
* font-viewer/font-view.c (set_icon): don't leak icon_name.
* font-viewer/ftstream-vfs.c (vfs_stream_open): don't leak
GFile pointer.
2008-11-18 Rodrigo Moya <rodrigo@gnome-db.org> 2008-11-18 Rodrigo Moya <rodrigo@gnome-db.org>
* font-viewer/font-view.c (set_icon): added missing * font-viewer/font-view.c (set_icon): added missing

View file

@ -385,8 +385,10 @@ set_icon(GtkWindow *window, const gchar *uri)
info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE, info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
G_FILE_QUERY_INFO_NONE, NULL, NULL); G_FILE_QUERY_INFO_NONE, NULL, NULL);
if (! info) if (! info) {
goto end; g_object_unref (file);
return;
}
content_type = g_file_info_get_content_type (info); content_type = g_file_info_get_content_type (info);
icon = g_content_type_get_icon (content_type); icon = g_content_type_get_icon (content_type);
@ -398,22 +400,20 @@ set_icon(GtkWindow *window, const gchar *uri)
if (names) { if (names) {
gint i; gint i;
for (i = 0; names[i]; i++) for (i = 0; names[i]; i++)
if (gtk_icon_theme_has_icon (icon_theme, names[i])) if (gtk_icon_theme_has_icon (icon_theme, names[i])) {
icon_name = g_strdup (names[i]); icon_name = g_strdup (names[i]);
break;
}
} }
} }
if (icon_name) if (icon_name) {
gtk_window_set_icon_name (window, icon_name); gtk_window_set_icon_name (window, icon_name);
g_free (icon_name);
}
g_object_unref (icon); g_object_unref (icon);
g_free (content_type); g_free (content_type);
end:
if (icon_name)
g_free(icon_name);
g_object_unref (file);
} }
int int

View file

@ -68,10 +68,10 @@ static FT_Error
vfs_stream_open(FT_Stream stream, vfs_stream_open(FT_Stream stream,
const char *uri) const char *uri)
{ {
GFile *file = NULL; GFile *file;
GError *error = NULL; GError *error = NULL;
GFileInfo *info = NULL; GFileInfo *info;
GFileInputStream *handle = NULL; GFileInputStream *handle;
if (!stream) if (!stream)
return FT_Err_Invalid_Stream_Handle; return FT_Err_Invalid_Stream_Handle;
@ -81,6 +81,7 @@ vfs_stream_open(FT_Stream stream,
handle = g_file_read (file, NULL, &error); handle = g_file_read (file, NULL, &error);
if (! handle) { if (! handle) {
g_message (error->message); g_message (error->message);
g_object_unref (file);
g_error_free (error); g_error_free (error);
return FT_Err_Cannot_Open_Resource; return FT_Err_Cannot_Open_Resource;