Don't leak a file_path; don't unref a null file_info

Signed-off-by: Federico Mena Quintero <federico@novell.com>
This commit is contained in:
Federico Mena Quintero
2010-08-25 12:20:12 -05:00
parent 51571481a4
commit 8f0f104c8d

View File

@@ -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;
}