[gnome-online-accounts/wip/rishi/kerberos: 1/7] identity: Don't leak the GoaObject from find_object_with_principal



commit f8079ce84a90117e42b407ba6e0ab90489244574
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 7ce8011..7e35d17 100644
--- a/src/goaidentity/goaidentityservice.c
+++ b/src/goaidentity/goaidentityservice.c
@@ -430,7 +430,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);
@@ -452,6 +452,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);
 }
 
@@ -735,7 +737,7 @@ on_identity_needs_renewal (GoaIdentityManager *identity_manager,
                            GoaIdentityService *self)
 {
   const char *principal;
-  GoaObject  *object;
+  GoaObject  *object = NULL;
 
   principal = goa_identity_get_identifier (identity);
 
@@ -744,8 +746,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);
@@ -757,6 +758,9 @@ on_identity_needs_renewal (GoaIdentityManager *identity_manager,
                                        (GAsyncReadyCallback)
                                        on_identity_renewed,
                                        self);
+
+ out:
+  g_clear_object (&object);
 }
 
 static void
@@ -953,6 +957,8 @@ on_identity_added (GoaIdentityManager *identity_manager,
 
   if (object == NULL)
     add_temporary_account (self, identity);
+
+  g_clear_object (&object);
 }
 
 static void
@@ -970,6 +976,7 @@ on_identity_removed (GoaIdentityManager *identity_manager,
     ensure_account_credentials (self, object);
 
   unexport_identity (self, identity);
+  g_clear_object (&object);
 }
 
 static void
@@ -987,6 +994,8 @@ on_identity_refreshed (GoaIdentityManager *identity_manager,
     add_temporary_account (self, identity);
   else
     ensure_account_credentials (self, object);
+
+  g_clear_object (&object);
 }
 
 typedef struct
@@ -1327,6 +1336,7 @@ on_identity_expiring (GoaIdentityManager *identity_manager,
     return;
 
   ensure_account_credentials (self, object);
+  g_clear_object (&object);
 }
 
 static void
@@ -1347,6 +1357,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]