[gnome-online-accounts/rhel-7.1: 2/34] kerberos: refactor register_error_domain



commit 6cca20a58e4a5101c0f093dd9130cfc78ebec37b
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 064c3f6..9206099 100644
--- a/src/goaidentity/goaidentityutils.c
+++ b/src/goaidentity/goaidentityutils.c
@@ -181,7 +181,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;
 
@@ -214,8 +214,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]