[gnome-photos/wip/rishi/base-item-trash-error-double-free: 2/2] base-item: Don't free the GError twice




commit 0ebc2a29787ad34e02c8ea401ad98432df17607b
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

 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 267505e7..6ccde753 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]