[calls] sip: Avoid dereferencing a NULL pointer



commit c9dd476fa82ffde87ee34d985279a2e128aed451
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date:   Wed Aug 25 21:53:24 2021 +0200

    sip: Avoid dereferencing a NULL pointer
    
    secret_password_*_finish() may return FALSE without setting the GError.
    F.e. trying to remove a non existent secret is not a failure.
    
    The bug supposedly manifests itself because the updating account credentials
    from the UI does not always seem to work correctly.

 plugins/sip/calls-sip-provider.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/plugins/sip/calls-sip-provider.c b/plugins/sip/calls-sip-provider.c
index ccf4c779..03b2d2e2 100644
--- a/plugins/sip/calls-sip-provider.c
+++ b/plugins/sip/calls-sip-provider.c
@@ -210,7 +210,8 @@ on_origin_pw_cleared (GObject      *source,
   g_autoptr (GError) error = NULL;
 
   if (!secret_password_clear_finish (result, &error))
-    g_warning ("Could not delete the password in the keyring: %s", error->message);
+    g_warning ("Could not delete the password in the keyring: %s",
+               error ? error->message : "No reason given");
 }
 
 
@@ -243,7 +244,8 @@ on_origin_pw_saved (GObject      *source,
   g_autoptr (GError) error = NULL;
 
   if (!secret_password_store_finish (result, &error)) {
-    g_warning ("Could not store the password in the keyring: %s", error->message);
+    g_warning ("Could not store the password in the keyring: %s",
+               error ? error->message : "No reason given");
   }
 }
 


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