diff options
author | Ignacy Kuchciński <ignacykuchcinski@gmail.com> | 2022-09-08 23:25:36 +0200 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2022-12-04 15:24:25 +0000 |
commit | d622bad925e7adac5a83ee48181f56d24d20c02f (patch) | |
tree | 372472c5560cb03dc278c3a7d2d150fe06f72013 | |
parent | 601b018eb820bf7b683061feb0a142a941751af4 (diff) | |
download | nautilus-d622bad925e7adac5a83ee48181f56d24d20c02f.tar.gz |
window-slot: Fix leak
Currently, if the new_selection list is NULL, then the
check_select_old_location_containing_folder function sets it to a newly
allocated list.
Since we don't own the new_selection list, let's copy it before passing
it to the check_select_old_location_containing_folder function so that
it always returns a newly allocated list, which we make the
pending_selection point to in order to avoid a leak.
-rw-r--r-- | src/nautilus-window-slot.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c index 2efa6cadf..2659916b2 100644 --- a/src/nautilus-window-slot.c +++ b/src/nautilus-window-slot.c @@ -1354,15 +1354,16 @@ begin_location_change (NautilusWindowSlot *self, nautilus_window_slot_set_allow_stop (self, TRUE); - new_selection = check_select_old_location_containing_folder (new_selection, location, previous_location); - g_assert (self->pending_location == NULL); self->pending_location = g_object_ref (location); self->location_change_type = type; self->location_change_distance = distance; self->tried_mount = FALSE; - self->pending_selection = nautilus_file_list_copy (new_selection); + self->pending_selection = + check_select_old_location_containing_folder (nautilus_file_list_copy (new_selection), + location, + previous_location); self->pending_scroll_to = g_strdup (scroll_pos); |