[cheese/wip/fixes: 7/9] Fix cheese_thumb_view_append_item() memory leaks
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/wip/fixes: 7/9] Fix cheese_thumb_view_append_item() memory leaks
- Date: Wed, 6 Nov 2013 12:07:35 +0000 (UTC)
commit 94c2bfb900148e7d711ae704fce9a1b51c2eb24f
Author: David King <amigadave amigadave com>
Date: Tue Nov 5 23:26:13 2013 +0000
Fix cheese_thumb_view_append_item() memory leaks
Fix several memory leaks found with valgrind.
src/thumbview/cheese-thumb-view.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/thumbview/cheese-thumb-view.c b/src/thumbview/cheese-thumb-view.c
index a702fc0..9976caf 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]