[nautilus/wip/antoniof/meets-valgrind: 16/16] list-view: Don't leak container array
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/meets-valgrind: 16/16] list-view: Don't leak container array
- Date: Tue, 5 Jan 2021 08:50:26 +0000 (UTC)
commit 39e05c23687b9af2cac6fc982b2f90aadb2a9c95
Author: António Fernandes <antoniof gnome org>
Date: Sat Dec 19 15:11:43 2020 +0000
list-view: Don't leak container array
When converting the array into a list, the list takes the data. But the
original container is leaked.
Get the array inside the helper function and free it after its data is
taken. Also rename the helper funcion appropriately.
src/nautilus-list-view.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index a4fabb924..0bfb7dec4 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -2468,10 +2468,13 @@ get_default_visible_columns (NautilusListView *list_view)
}
static GList *
-default_column_array_as_list (gchar **array)
+get_default_visible_columns_as_list (NautilusListView *list_view)
{
GList *res = NULL;
gint i = 0;
+ gchar **array;
+
+ array = get_default_visible_columns (list_view);
while (array[i] != NULL)
{
@@ -2479,6 +2482,8 @@ default_column_array_as_list (gchar **array)
i++;
}
+ g_free (array);
+
return res;
}
@@ -2506,7 +2511,7 @@ get_visible_columns (NautilusListView *list_view)
NAUTILUS_METADATA_KEY_LIST_VIEW_VISIBLE_COLUMNS);
if (visible_columns == NULL)
{
- visible_columns = default_column_array_as_list (get_default_visible_columns (list_view));
+ visible_columns = get_default_visible_columns_as_list (list_view);
}
res = g_ptr_array_new ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]