summaryrefslogtreecommitdiff
path: root/src/thumbview
diff options
context:
space:
mode:
authorDavid King <amigadave@amigadave.com>2013-11-05 23:26:13 +0000
committerDavid King <amigadave@amigadave.com>2013-11-06 12:06:50 +0000
commit94c2bfb900148e7d711ae704fce9a1b51c2eb24f (patch)
treef261816a712d26874f3ca71ef16b4718547fd56e /src/thumbview
parent0e739a64f78246af2afc9a74155ac47fce756e51 (diff)
downloadcheese-94c2bfb900148e7d711ae704fce9a1b51c2eb24f.tar.gz
Fix cheese_thumb_view_append_item() memory leaks
Fix several memory leaks found with valgrind.
Diffstat (limited to 'src/thumbview')
-rw-r--r--src/thumbview/cheese-thumb-view.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/thumbview/cheese-thumb-view.c b/src/thumbview/cheese-thumb-view.c
index a702fc0b..9976cafa 100644
--- a/src/thumbview/cheese-thumb-view.c
+++ b/src/thumbview/cheese-thumb-view.c
@@ -195,7 +195,7 @@ cheese_thumb_view_append_item (CheeseThumbView *thumb_view, GFile *file)
GtkIconTheme *icon_theme;
GdkPixbuf *pixbuf = NULL;
GtkTreePath *path;
- char *filename, *basename, *col_filename;
+ char *filename, *basename;
GError *error = NULL;
gboolean skip = FALSE;
GFileInfo *info;
@@ -231,13 +231,19 @@ cheese_thumb_view_append_item (CheeseThumbView *thumb_view, GFile *file)
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->store), &iter))
{
+ gchar *col_filename;
+
/* check if the selected item is the first, else go through the store */
gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter, THUMBNAIL_URL_COLUMN, &col_filename, -1);
+ /* FIXME: col_filename is in GLib filename encoding, not ASCII. */
if (g_ascii_strcasecmp (col_filename, filename))
{
while (gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->store), &iter))
{
+ g_free (col_filename);
+
gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter, THUMBNAIL_URL_COLUMN, &col_filename, -1);
+ /* FIXME: col_filename is in GLib filename encoding, not ASCII. */
if (!g_ascii_strcasecmp (col_filename, filename))
{
skip = TRUE;
@@ -254,6 +260,10 @@ cheese_thumb_view_append_item (CheeseThumbView *thumb_view, GFile *file)
if (skip) return;
}
+ else
+ {
+ g_free (filename);
+ }
if (priv->multiplex_thumbnail_generator)
{
@@ -293,6 +303,7 @@ cheese_thumb_view_append_item (CheeseThumbView *thumb_view, GFile *file)
path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->store), &iter);
gtk_icon_view_scroll_to_path (GTK_ICON_VIEW (thumb_view), path,
TRUE, 1.0, 0.5);
+ gtk_tree_path_free (path);
if (pixbuf) g_object_unref (pixbuf);