diff options
author | António Fernandes <antoniof@gnome.org> | 2020-12-19 12:00:04 +0000 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2021-01-05 08:50:24 +0000 |
commit | 90a58d972dbe069c1db4e1a359cec908c9650760 (patch) | |
tree | 5d6be0c8a0c1b5538816beac41b6cc9b87f88813 | |
parent | 61063868fa16f840f039e719ea4d138f64d7a0ea (diff) | |
download | nautilus-90a58d972dbe069c1db4e1a359cec908c9650760.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.
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
-rw-r--r-- | src/nautilus-application.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nautilus-application.c b/src/nautilus-application.c index 10478da9c..7842a582a 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 **remaining = NULL; GPtrArray *file_array; g_variant_dict_lookup (options, G_OPTION_REMAINING, "^a&s", &remaining); |