neil / rpms / udisks2

Forked from rpms/udisks2 a year ago
Clone
8ae392
From f486a9fa22c2f9785a4a8fc58eb3be7b0cf934ce Mon Sep 17 00:00:00 2001
8ae392
From: Tomas Bzatek <tbzatek@redhat.com>
8ae392
Date: Sat, 1 Jan 2022 19:59:27 +0100
8ae392
Subject: [PATCH] udiskslinuxpartitiontable: Fix GError ownership
8ae392
8ae392
---
8ae392
 src/udiskslinuxpartitiontable.c | 11 ++++-------
8ae392
 1 file changed, 4 insertions(+), 7 deletions(-)
8ae392
8ae392
diff --git a/src/udiskslinuxpartitiontable.c b/src/udiskslinuxpartitiontable.c
8ae392
index b4c301095..14a54c9c7 100644
8ae392
--- a/src/udiskslinuxpartitiontable.c
8ae392
+++ b/src/udiskslinuxpartitiontable.c
8ae392
@@ -277,7 +277,7 @@ udisks_linux_partition_table_handle_create_partition (UDisksPartitionTable   *ta
8ae392
   object = udisks_daemon_util_dup_object (table, &error);
8ae392
   if (object == NULL)
8ae392
     {
8ae392
-      g_dbus_method_invocation_take_error (invocation, error);
8ae392
+      g_dbus_method_invocation_return_gerror (invocation, error);
8ae392
       goto out;
8ae392
     }
8ae392
 
8ae392
@@ -293,7 +293,6 @@ udisks_linux_partition_table_handle_create_partition (UDisksPartitionTable   *ta
8ae392
       goto out;
8ae392
     }
8ae392
 
8ae392
-  error = NULL;
8ae392
   if (!udisks_daemon_util_get_caller_uid_sync (daemon,
8ae392
                                                invocation,
8ae392
                                                NULL /* GCancellable */,
8ae392
@@ -301,7 +300,6 @@ udisks_linux_partition_table_handle_create_partition (UDisksPartitionTable   *ta
8ae392
                                                &error))
8ae392
     {
8ae392
       g_dbus_method_invocation_return_gerror (invocation, error);
8ae392
-      g_clear_error (&error);
8ae392
       goto out;
8ae392
     }
8ae392
 
8ae392
@@ -464,7 +462,7 @@ udisks_linux_partition_table_handle_create_partition (UDisksPartitionTable   *ta
8ae392
       if (!bd_part_set_part_name (device_name, part_spec->path, name, &error))
8ae392
         {
8ae392
           g_prefix_error (&error, "Error setting name for newly created partition: ");
8ae392
-          g_dbus_method_invocation_take_error (invocation, error);
8ae392
+          g_dbus_method_invocation_return_gerror (invocation, error);
8ae392
           udisks_simple_job_complete (UDISKS_SIMPLE_JOB (job), FALSE, error->message);
8ae392
           goto out;
8ae392
         }
8ae392
@@ -483,7 +481,7 @@ udisks_linux_partition_table_handle_create_partition (UDisksPartitionTable   *ta
8ae392
       if (!ret)
8ae392
         {
8ae392
           g_prefix_error (&error, "Error setting type for newly created partition: ");
8ae392
-          g_dbus_method_invocation_take_error (invocation, error);
8ae392
+          g_dbus_method_invocation_return_gerror (invocation, error);
8ae392
           udisks_simple_job_complete (UDISKS_SIMPLE_JOB (job), FALSE, error->message);
8ae392
           goto out;
8ae392
         }
8ae392
@@ -520,7 +518,6 @@ udisks_linux_partition_table_handle_create_partition (UDisksPartitionTable   *ta
8ae392
   /* sit and wait for the partition to show up */
8ae392
   g_warn_if_fail (wait_data->pos_to_wait_for > 0);
8ae392
   wait_data->partition_table_object = object;
8ae392
-  error = NULL;
8ae392
   partition_object = udisks_daemon_wait_for_object_sync (daemon,
8ae392
                                                          wait_for_partition,
8ae392
                                                          wait_data,
8ae392
@@ -530,7 +527,7 @@ udisks_linux_partition_table_handle_create_partition (UDisksPartitionTable   *ta
8ae392
   if (partition_object == NULL)
8ae392
     {
8ae392
       g_prefix_error (&error, "Error waiting for partition to appear: ");
8ae392
-      g_dbus_method_invocation_take_error (invocation, error);
8ae392
+      g_dbus_method_invocation_return_gerror (invocation, error);
8ae392
       udisks_simple_job_complete (UDISKS_SIMPLE_JOB (job), FALSE, error->message);
8ae392
       goto out;
8ae392
     }