[gtk+/multiroot-filechooser-2-20: 21/21] Don't leak a file_path; don't unref a null file_info
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/multiroot-filechooser-2-20: 21/21] Don't leak a file_path; don't unref a null file_info
- Date: Wed, 25 Aug 2010 17:46:33 +0000 (UTC)
commit 8f0f104c8dd1a2eefba4ce71aad3b9aeffe18314
Author: Federico Mena Quintero <federico novell com>
Date: Wed Aug 25 12:20:12 2010 -0500
Don't leak a file_path; don't unref a null file_info
Signed-off-by: Federico Mena Quintero <federico novell com>
gtk/gtkfilechooser.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkfilechooser.c b/gtk/gtkfilechooser.c
index 972177e..5c6669c 100644
--- a/gtk/gtkfilechooser.c
+++ b/gtk/gtkfilechooser.c
@@ -2949,6 +2949,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;
@@ -2959,12 +2960,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;
}
@@ -2977,7 +2980,6 @@ _gtk_file_chooser_get_visible_roots (GtkFileChooser *chooser)
if (file_info == NULL)
{
- g_object_unref (file_info);
g_object_unref (file);
continue;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]