[gnome-photos/gnome-3-38] base-item: Don't free the GError twice



commit 0f479125447c1a36f8e10e752632618f26b30874
Author: Debarshi Ray <debarshir gnome org>
Date:   Sun Mar 14 15:26:46 2021 +0100

    base-item: Don't free the GError twice
    
    The ownership of the GError is claimed by g_task_return_error, so the
    pointer needs to be set to NULL after the call. Otherwise, thanks to
    g_autoptr, it will be freed twice and cause a memory error.
    
    Fallout from c855a5a7cce5d023c091b24c2583e76b2a8fcd42
    
    https://gitlab.gnome.org/GNOME/gnome-photos/-/merge_requests/177

 src/photos-base-item.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 38d47c69..817fe5c2 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -2754,7 +2754,7 @@ photos_base_item_trash_executed (GObject *source_object, GAsyncResult *res, gpoi
 
     if (!photos_delete_item_job_finish (job, res, &error))
       {
-        g_task_return_error (task, error);
+        g_task_return_error (task, g_steal_pointer (&error));
         goto out;
       }
   }


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