diff options
author | Florian Müllner <fmuellner@gnome.org> | 2016-01-09 00:37:54 +0100 |
---|---|---|
committer | Florian Müllner <fmuellner@gnome.org> | 2016-01-13 15:54:09 +0100 |
commit | b49246dae890acd376bee585e54cbf73218c33dd (patch) | |
tree | 0afcd7d0f3f44189f27936a9a800784ddb5e4506 | |
parent | e3d2316758890e896e0d3ffe487bc9fd75616ab5 (diff) | |
download | nautilus-b49246dae890acd376bee585e54cbf73218c33dd.tar.gz |
files-view: Fix double-free of file list in scripts menu
When building the scripts menu, update_directory_in_scripts_menu()
gets the list of files in the script directory, filters out hidden
files and sorts the filtered list by display name. Unlike the filtering
step, which returns a new list with ref'ed files, sorting may change
the start of the list, but not the list's actual content. As a result,
the nautilus_file_list_free() call added in commit 864c815479a25 tries
to free already freed memory (i.e. disposed files), resulting in a
crash when any scripts are found.
https://bugzilla.gnome.org/show_bug.cgi?id=760338
-rw-r--r-- | src/nautilus-files-view.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c index b486fb357..6fa737d16 100644 --- a/src/nautilus-files-view.c +++ b/src/nautilus-files-view.c @@ -4804,11 +4804,11 @@ update_directory_in_scripts_menu (NautilusFilesView *view, nautilus_file_list_free (file_list); menu = g_menu_new (); - file_list = nautilus_file_list_sort_by_display_name (filtered); + filtered = nautilus_file_list_sort_by_display_name (filtered); num = 0; any_scripts = FALSE; - for (node = file_list; num < TEMPLATE_LIMIT && node != NULL; node = node->next, num++) { + for (node = filtered; num < TEMPLATE_LIMIT && node != NULL; node = node->next, num++) { file = node->data; if (nautilus_file_is_directory (file)) { uri = nautilus_file_get_uri (file); @@ -4838,7 +4838,6 @@ update_directory_in_scripts_menu (NautilusFilesView *view, } } - nautilus_file_list_free (file_list); nautilus_file_list_free (filtered); if (!any_scripts) { |