summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntónio Fernandes <antoniof@gnome.org>2020-12-19 12:00:04 +0000
committerAntónio Fernandes <antoniof@gnome.org>2020-12-19 18:53:13 +0000
commit6fe28a038fa240e894dc9c1d2669eac5e9d1c51c (patch)
treef6ea3abd66fadf53960a9aaee2412b1ba9dd7692
parenta57f9aba9c5a55c9708058fd032fc185ffc52a44 (diff)
downloadnautilus-6fe28a038fa240e894dc9c1d2669eac5e9d1c51c.tar.gz
application: Don't leak container array
We extract an array constant strings from a GVariant dict using the "^a&s" format string, which is equivalent to g_variant_get_strv() [0] g_variant_get_srtv() is "(transfer container)", meaning the caller owns the array.[1] However, we don't free the array, resulting in a memory leak. [2] Use autocleanup to fix the leak. [0] https://developer.gnome.org/glib/stable/gvariant-format-strings.html#gvariant-format-strings-convenience [1] https://developer.gnome.org/glib/stable/glib-GVariant.html#g-variant-get-strv [2] Leak found in valgrind file provided by nekohayo
-rw-r--r--src/nautilus-application.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 10478da9c..a034b3c8b 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -938,7 +938,7 @@ nautilus_application_handle_file_args (NautilusApplication *self,
GFile **files;
GFile *file;
gint idx, len;
- const gchar * const *remaining = NULL;
+ g_autofree const gchar * const *remaining = NULL;
GPtrArray *file_array;
g_variant_dict_lookup (options, G_OPTION_REMAINING, "^a&s", &remaining);