[gnome-online-accounts/gnome-3-12] kerberos: refactor register_error_domain



commit 2b4127977f6267c56227f57b66ab4feeb274fe5b
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Mar 17 09:26:03 2014 -0400

    kerberos: refactor register_error_domain
    
    This commit move type class freeing to the
    otherside of the "out" label to make the code
    robust against potential future changes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726353

 src/goaidentity/goaidentityutils.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/src/goaidentity/goaidentityutils.c b/src/goaidentity/goaidentityutils.c
index 6350820..159b1d9 100644
--- a/src/goaidentity/goaidentityutils.c
+++ b/src/goaidentity/goaidentityutils.c
@@ -178,7 +178,7 @@ goa_identity_utils_register_error_domain (GQuark error_domain,
   const char *error_domain_string;
   char *type_name = NULL;
   GType type;
-  GTypeClass *type_class;
+  GTypeClass *type_class = NULL;
   GEnumClass *enum_class;
   guint i;
 
@@ -211,8 +211,7 @@ goa_identity_utils_register_error_domain (GQuark error_domain,
       g_free (dbus_error_string);
     }
 
-  g_type_class_unref (type_class);
-
  out:
+  g_clear_pointer (&type_class, g_type_class_unref);
   g_free (type_name);
 }


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