[nautilus/wip/oholy/invalid-read] operations-ui-manager: Fix crash after a conflict dialog response



commit 848b358b0b4c0349401013883ada6609d6527cf4
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Jan 23 11:38:14 2020 +0100

    operations-ui-manager: Fix crash after a conflict dialog response
    
    After a conflict dialog response, Nautilus accesses an already released
    structure, which causes crashes for some people. Let's store pointer
    before releasing the structure in order to prevent the invalid reads.
    
    Fixes: https://gitlab.gnome.org/GNOME/nautilus/issues/1353

 src/nautilus-operations-ui-manager.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-operations-ui-manager.c b/src/nautilus-operations-ui-manager.c
index fbaac05c9..bfb574cb9 100644
--- a/src/nautilus-operations-ui-manager.c
+++ b/src/nautilus-operations-ui-manager.c
@@ -486,6 +486,7 @@ copy_move_conflict_ask_user_action (GtkWindow *parent_window,
                                     GFile     *destination_directory_name)
 {
     FileConflictDialogData *data;
+    FileConflictResponse *response;
 
     data = g_slice_new0 (FileConflictDialogData);
     data->parent = parent_window;
@@ -493,7 +494,7 @@ copy_move_conflict_ask_user_action (GtkWindow *parent_window,
     data->destination_name = destination_name;
     data->destination_directory_name = destination_directory_name;
 
-    data->response = g_slice_new0 (FileConflictResponse);
+    data->response = response = g_slice_new0 (FileConflictResponse);
     data->response->new_name = NULL;
 
     data->on_file_list_ready = copy_move_conflict_on_file_list_ready;
@@ -504,7 +505,7 @@ copy_move_conflict_ask_user_action (GtkWindow *parent_window,
 
     g_slice_free (FileConflictDialogData, data);
 
-    return data->response;
+    return response;
 }
 
 typedef struct


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]