summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntónio Fernandes <antoniof@gnome.org>2020-05-17 15:27:23 +0100
committerAntónio Fernandes <antoniof@gnome.org>2020-05-17 15:39:37 +0100
commit9ef5d8344bf8355eceff291d9cd7029b532b9933 (patch)
tree201387a803be4192219ed49f70ed095edeb37f18
parent6cb1715c77e2276036804e6c5243df9fad8c3d72 (diff)
downloadnautilus-9ef5d8344bf8355eceff291d9cd7029b532b9933.tar.gz
file: Fix reference leak
We are missing a "nautilus_file_unref(parent);" statement is missing in the get_filesystem_remote() method, leaking a reference. This was detected by a failing self-check test in a branch: https://gitlab.gnome.org/GNOME/nautilus/-/jobs/720894 Let's fix this with autocleanup. For consistency, change the neighboor get_filesystem_type() to use autocleanup too, instead of the explicit nautilus_file_unref().
-rw-r--r--src/nautilus-file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index ab9d33e01..33aabf65f 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -4664,7 +4664,6 @@ nautilus_file_get_filesystem_use_preview (NautilusFile *file)
char *
nautilus_file_get_filesystem_type (NautilusFile *file)
{
- NautilusFile *parent;
char *filesystem_type = NULL;
g_assert (NAUTILUS_IS_FILE (file));
@@ -4675,11 +4674,12 @@ nautilus_file_get_filesystem_type (NautilusFile *file)
}
else
{
+ g_autoptr (NautilusFile) parent = NULL;
+
parent = nautilus_file_get_parent (file);
if (parent != NULL)
{
filesystem_type = g_strdup (parent->details->filesystem_type);
- nautilus_file_unref (parent);
}
}
@@ -4689,8 +4689,6 @@ nautilus_file_get_filesystem_type (NautilusFile *file)
gboolean
nautilus_file_get_filesystem_remote (NautilusFile *file)
{
- NautilusFile *parent;
-
g_assert (NAUTILUS_IS_FILE (file));
if (nautilus_file_is_directory (file))
@@ -4699,6 +4697,8 @@ nautilus_file_get_filesystem_remote (NautilusFile *file)
}
else
{
+ g_autoptr (NautilusFile) parent = NULL;
+
parent = nautilus_file_get_parent (file);
if (parent != NULL)
{