[gnome-online-accounts/gnome-3-10] kerberos: consolidate exit path code in identity_renew



commit 7ef0129cb5214e485c432e559dfc416ff4162279
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Mar 17 09:44:05 2014 -0400

    kerberos: consolidate exit path code in identity_renew
    
    the principal is freed in 3 different places.  This commit
    consolidates it to one place for clarity and added robustness
    against future changes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726353

 src/goaidentity/goakerberosidentity.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/src/goaidentity/goakerberosidentity.c b/src/goaidentity/goakerberosidentity.c
index 5ccbcac..00d3b83 100644
--- a/src/goaidentity/goakerberosidentity.c
+++ b/src/goaidentity/goakerberosidentity.c
@@ -1391,8 +1391,7 @@ goa_kerberos_identity_renew (GoaKerberosIdentity *self, GError **error)
                                       _
                                       ("Could not get new credentials to renew identity %s: %k"),
                                       name);
-      krb5_free_principal (self->priv->kerberos_context, principal);
-      goto out;
+      goto free_principal;
     }
 
   if (!goa_kerberos_identity_update_credentials (self,
@@ -1400,13 +1399,13 @@ goa_kerberos_identity_renew (GoaKerberosIdentity *self, GError **error)
                                                  &new_credentials,
                                                  error))
     {
-      krb5_free_principal (self->priv->kerberos_context, principal);
-      goto out;
+      goto free_principal;
     }
 
   goa_debug ("GoaKerberosIdentity: identity %s renewed", name);
   renewed = TRUE;
 
+free_principal:
   krb5_free_principal (self->priv->kerberos_context, principal);
 
 out:


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