[glib] gobject: unref unused class



commit 6a8c2685be3992d0aac0c54d12a3fb31dd198624
Author: Marek Kasik <mkasik redhat com>
Date:   Thu May 22 11:00:14 2014 +0200

    gobject: unref unused class
    
    If g_type_class_ref() returns a class which is not
    a GObjectClass we need to unref it before return in
    object_interface_check_properties().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706983

 gobject/gobject.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 78fe203..4a35cd0 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -1404,9 +1404,12 @@ object_interface_check_properties (gpointer check_data,
 
   class = g_type_class_ref (iface_class->g_instance_type);
 
-  if (!G_IS_OBJECT_CLASS (class))
+  if (class == NULL)
     return;
 
+  if (!G_IS_OBJECT_CLASS (class))
+    goto out;
+
   pspecs = g_param_spec_pool_list (pspec_pool, iface_type, &n);
 
   while (n--)
@@ -1537,6 +1540,7 @@ object_interface_check_properties (gpointer check_data,
 
   g_free (pspecs);
 
+ out:
   g_type_class_unref (class);
 }
 


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