[gnome-online-accounts/gnome-3-18] identity: Don't leak the GoaObject from find_object_with_principal



commit 06b6681ca9e84ede0ed755c2fd217282285a300d
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Jul 30 19:07:55 2016 +0200

    identity: Don't leak the GoaObject from find_object_with_principal
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756431

 src/goaidentity/goaidentityservice.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/goaidentity/goaidentityservice.c b/src/goaidentity/goaidentityservice.c
index 165dc2f..5bef884 100644
--- a/src/goaidentity/goaidentityservice.c
+++ b/src/goaidentity/goaidentityservice.c
@@ -444,7 +444,7 @@ on_identity_signed_out (GoaIdentityManager *manager,
   GError             *error;
   GoaIdentity        *identity;
   const char         *identifier;
-  GoaObject          *object;
+  GoaObject          *object = NULL;
 
   error = NULL;
   goa_identity_manager_sign_identity_out_finish (manager, result, &error);
@@ -466,6 +466,8 @@ on_identity_signed_out (GoaIdentityManager *manager,
     ensure_account_credentials (self, object);
 
   g_simple_async_result_complete_in_idle (operation_result);
+
+  g_clear_object (&object);
   g_object_unref (operation_result);
 }
 
@@ -749,7 +751,7 @@ on_identity_needs_renewal (GoaIdentityManager *identity_manager,
                            GoaIdentityService *self)
 {
   const char *principal;
-  GoaObject  *object;
+  GoaObject  *object = NULL;
 
   principal = goa_identity_get_identifier (identity);
 
@@ -758,8 +760,7 @@ on_identity_needs_renewal (GoaIdentityManager *identity_manager,
   if (object != NULL && should_ignore_object (self, object))
     {
       g_debug ("GoaIdentityService: ignoring identity %s that says it needs renewal", principal);
-
-      return;
+      goto out;
     }
 
   g_debug ("GoaIdentityService: identity %s needs renewal", principal);
@@ -771,6 +772,9 @@ on_identity_needs_renewal (GoaIdentityManager *identity_manager,
                                        (GAsyncReadyCallback)
                                        on_identity_renewed,
                                        self);
+
+ out:
+  g_clear_object (&object);
 }
 
 static void
@@ -966,6 +970,8 @@ on_identity_added (GoaIdentityManager *identity_manager,
 
   if (object == NULL)
     add_temporary_account (self, identity);
+
+  g_clear_object (&object);
 }
 
 static void
@@ -983,6 +989,7 @@ on_identity_removed (GoaIdentityManager *identity_manager,
     ensure_account_credentials (self, object);
 
   unexport_identity (self, identity);
+  g_clear_object (&object);
 }
 
 static void
@@ -1000,6 +1007,8 @@ on_identity_refreshed (GoaIdentityManager *identity_manager,
     add_temporary_account (self, identity);
   else
     ensure_account_credentials (self, object);
+
+  g_clear_object (&object);
 }
 
 typedef struct
@@ -1340,6 +1349,7 @@ on_identity_expiring (GoaIdentityManager *identity_manager,
     return;
 
   ensure_account_credentials (self, object);
+  g_clear_object (&object);
 }
 
 static void
@@ -1360,6 +1370,7 @@ on_identity_expired (GoaIdentityManager *identity_manager,
     return;
 
   ensure_account_credentials (self, object);
+  g_clear_object (&object);
 }
 
 static void


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