[gobject-introspection] girepository: Fix leak in g_vfunc_info_get_address



commit 1da728ffa1d15a9c85d7bb85b2947134bafeb8ea
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sat Aug 25 04:05:17 2012 -0300

    girepository: Fix leak in g_vfunc_info_get_address
    
    We need to fix the struct info here.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682647

 girepository/givfuncinfo.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/girepository/givfuncinfo.c b/girepository/givfuncinfo.c
index f9ba64a..9d6ea39 100644
--- a/girepository/givfuncinfo.c
+++ b/girepository/givfuncinfo.c
@@ -220,7 +220,8 @@ g_vfunc_info_get_address (GIVFuncInfo      *vfunc_info,
   GIStructInfo *struct_info;
   GIFieldInfo *field_info = NULL;
   int length, i, offset;
-  gpointer implementor_vtable, func;
+  gpointer implementor_vtable;
+  gpointer func = NULL;
 
   object_info = (GIObjectInfo *) g_base_info_get_container (vfunc_info);
   struct_info = g_object_info_get_class_struct (object_info);
@@ -246,7 +247,7 @@ g_vfunc_info_get_address (GIVFuncInfo      *vfunc_info,
                    G_INVOKE_ERROR,
                    G_INVOKE_ERROR_SYMBOL_NOT_FOUND,
                    "Couldn't find struct field for this vfunc");
-      return NULL;
+      goto out;
     }
 
   implementor_vtable = g_type_class_ref (implementor_gtype);
@@ -263,9 +264,12 @@ g_vfunc_info_get_address (GIVFuncInfo      *vfunc_info,
                    "Class %s doesn't implement %s",
                    g_type_name (implementor_gtype),
                    g_base_info_get_name ( (GIBaseInfo*) vfunc_info));
-      return NULL;
+      goto out;
     }
 
+ out:
+  g_base_info_unref ((GIBaseInfo*) struct_info);
+
   return func;
 }
 



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