From f26c9ab24501ed645607b6f6b4966260f6c200d9 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 15 Sep 2009 20:13:17 -0400 Subject: [PATCH] Fix memory leaks Need to free the returned thumbnail path, and in the CachePolicy.NONE case we also need to unref the cogl handle. https://bugzilla.gnome.org/show_bug.cgi?id=595321 --- src/shell-texture-cache.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/shell-texture-cache.c b/src/shell-texture-cache.c index 93835afb8..946021b9e 100644 --- a/src/shell-texture-cache.c +++ b/src/shell-texture-cache.c @@ -427,7 +427,10 @@ impl_load_thumbnail (ShellTextureCache *cache, existing_thumbnail = gnome_desktop_thumbnail_factory_lookup (thumbnail_factory, uri, mtime); if (existing_thumbnail != NULL) - pixbuf = gdk_pixbuf_new_from_file_at_size (existing_thumbnail, size, size, error); + { + pixbuf = gdk_pixbuf_new_from_file_at_size (existing_thumbnail, size, size, error); + g_free (existing_thumbnail); + } else if (gnome_desktop_thumbnail_factory_has_valid_failed_thumbnail (thumbnail_factory, uri, mtime)) g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Has failed thumbnail"); else if (gnome_desktop_thumbnail_factory_can_thumbnail (thumbnail_factory, uri, mime_type, mtime)) @@ -744,9 +747,14 @@ on_pixbuf_loaded (GObject *source, texdata); else cache_key_destroy (key); - } - set_texture_cogl_texture (data->texture, texdata); + set_texture_cogl_texture (data->texture, texdata); + } + else + { + set_texture_cogl_texture (data->texture, texdata); + cogl_handle_unref (texdata); + } out: if (data->icon)