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
This commit is contained in:
Colin Walters 2009-09-15 20:13:17 -04:00
parent 293adb9bcc
commit f26c9ab245

View File

@ -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);
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);
}
else
{
set_texture_cogl_texture (data->texture, texdata);
cogl_handle_unref (texdata);
}
out:
if (data->icon)