7bf807
From 7c9933c0f80faaabbed607983fdf77f8c4562df6 Mon Sep 17 00:00:00 2001
7bf807
From: Tomas Bzatek <tbzatek@redhat.com>
7bf807
Date: Sat, 1 Jan 2022 20:11:57 +0100
7bf807
Subject: [PATCH] udiskslinuxpartition: Fix GError ownership
7bf807
7bf807
---
7bf807
 src/udiskslinuxpartition.c | 15 ++++++---------
7bf807
 1 file changed, 6 insertions(+), 9 deletions(-)
7bf807
7bf807
diff --git a/src/udiskslinuxpartition.c b/src/udiskslinuxpartition.c
7bf807
index 5461b3903..3d970768d 100644
7bf807
--- a/src/udiskslinuxpartition.c
7bf807
+++ b/src/udiskslinuxpartition.c
7bf807
@@ -135,8 +135,7 @@ check_authorization (UDisksPartition       *partition,
7bf807
                                                caller_uid,
7bf807
                                                &error))
7bf807
     {
7bf807
-      g_dbus_method_invocation_return_gerror (invocation, error);
7bf807
-      g_clear_error (&error);
7bf807
+      g_dbus_method_invocation_take_error (invocation, error);
7bf807
       goto out;
7bf807
     }
7bf807
 
7bf807
@@ -351,7 +350,7 @@ handle_set_flags (UDisksPartition       *partition,
7bf807
   object = udisks_daemon_util_dup_object (partition, &error);
7bf807
   if (object == NULL)
7bf807
     {
7bf807
-      g_dbus_method_invocation_take_error (invocation, error);
7bf807
+      g_dbus_method_invocation_return_gerror (invocation, error);
7bf807
       goto out;
7bf807
     }
7bf807
 
7bf807
@@ -499,7 +498,7 @@ handle_set_name (UDisksPartition       *partition,
7bf807
   object = udisks_daemon_util_dup_object (partition, &error);
7bf807
   if (object == NULL)
7bf807
     {
7bf807
-      g_dbus_method_invocation_take_error (invocation, error);
7bf807
+      g_dbus_method_invocation_return_gerror (invocation, error);
7bf807
       goto out;
7bf807
     }
7bf807
 
7bf807
@@ -873,7 +872,7 @@ handle_resize (UDisksPartition       *partition,
7bf807
   object = udisks_daemon_util_dup_object (partition, &error);
7bf807
   if (object == NULL)
7bf807
     {
7bf807
-      g_dbus_method_invocation_take_error (invocation, error);
7bf807
+      g_dbus_method_invocation_return_gerror (invocation, error);
7bf807
       goto out;
7bf807
     }
7bf807
 
7bf807
@@ -994,7 +993,7 @@ handle_delete (UDisksPartition       *partition,
7bf807
   object = udisks_daemon_util_dup_object (partition, &error);
7bf807
   if (object == NULL)
7bf807
     {
7bf807
-      g_dbus_method_invocation_take_error (invocation, error);
7bf807
+      g_dbus_method_invocation_return_gerror (invocation, error);
7bf807
       goto out;
7bf807
     }
7bf807
 
7bf807
@@ -1012,9 +1011,7 @@ handle_delete (UDisksPartition       *partition,
7bf807
       if (!udisks_linux_block_teardown (block, invocation, options, &error))
7bf807
         {
7bf807
           if (invocation != NULL)
7bf807
-            g_dbus_method_invocation_take_error (invocation, error);
7bf807
-          else
7bf807
-            g_clear_error (&error);
7bf807
+            g_dbus_method_invocation_return_gerror (invocation, error);
7bf807
           goto out;
7bf807
         }
7bf807
     }