[gnome-remote-desktop] credentials: Do not crash when deleting non-existent credentials



commit 7704ba6c4721c747acc438b001570e3a2ba23561
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Tue Aug 2 06:45:58 2022 +0200

    credentials: Do not crash when deleting non-existent credentials
    
    libsecret apparently does not set an error, if the credentials to
    delete were not found.
    So, also check whether an error was set before assuming the failure of
    the operation.

 src/grd-credentials-libsecret.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/grd-credentials-libsecret.c b/src/grd-credentials-libsecret.c
index 48bfe635..50787386 100644
--- a/src/grd-credentials-libsecret.c
+++ b/src/grd-credentials-libsecret.c
@@ -155,9 +155,20 @@ grd_credentials_libsecret_clear (GrdCredentials      *credentials,
                                  GrdCredentialsType   type,
                                  GError             **error)
 {
-  return secret_password_clear_sync (schema_from_type (type),
-                                     NULL, error,
-                                     NULL);
+  g_autoptr (GError) local_error = NULL;
+
+  secret_password_clear_sync (schema_from_type (type),
+                              NULL, &local_error,
+                              NULL);
+  if (local_error)
+    {
+      g_propagate_error (error, g_steal_pointer (&local_error));
+      return FALSE;
+    }
+  else
+    {
+      return TRUE;
+    }
 }
 
 GrdCredentialsLibsecret *


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