From 8e164cc477f7136ab3c64da2bfef00bf199f09a7 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Wed, 25 Aug 2010 12:20:12 -0500 Subject: [PATCH] Don't leak a file_path; don't unref a null file_info Signed-off-by: Federico Mena Quintero --- gtk/gtkfilechooser.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gtk/gtkfilechooser.c b/gtk/gtkfilechooser.c index d82d630ac7..0e13a1bd20 100644 --- a/gtk/gtkfilechooser.c +++ b/gtk/gtkfilechooser.c @@ -2924,6 +2924,7 @@ _gtk_file_chooser_get_visible_roots (GtkFileChooser *chooser) GtkFileSystemVolume *volume; GFileInfo *file_info; char *file_path; + gboolean is_home_or_desktop; if (file == NULL) continue; @@ -2934,12 +2935,14 @@ _gtk_file_chooser_get_visible_roots (GtkFileChooser *chooser) * See if this is the Desktop directory or Home directory, which will * already be listed. */ - if (!g_strcmp0 (file_path, - g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP)) || - !g_strcmp0 (file_path, g_get_home_dir())) + is_home_or_desktop = (!g_strcmp0 (file_path, + g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP)) || + !g_strcmp0 (file_path, g_get_home_dir())); + g_free (file_path); + + if (is_home_or_desktop) { g_object_unref (file); - g_free (file_path); continue; } @@ -2952,7 +2955,6 @@ _gtk_file_chooser_get_visible_roots (GtkFileChooser *chooser) if (file_info == NULL) { - g_object_unref (file_info); g_object_unref (file); continue; }