[gjs] object: Fix memory leak



commit 69a259893d1b2ee588ee43d65f4dd8831ff3d379
Author: Colin Walters <walters verbum org>
Date:   Mon Nov 19 14:59:29 2012 -0500

    object: Fix memory leak
    
    Noticed while inspecting the code for a different valgrind error.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688674

 gi/object.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/gi/object.c b/gi/object.c
index 018acd1..736cf05 100644
--- a/gi/object.c
+++ b/gi/object.c
@@ -352,7 +352,7 @@ find_vfunc_on_parent(GIObjectInfo *info,
                      gchar        *name)
 {
     GIVFuncInfo *vfunc = NULL;
-    GIObjectInfo *parent, *old_parent;
+    GIObjectInfo *parent;
 
     /* ref the first info so that we don't destroy
      * it when unrefing parents later */
@@ -364,13 +364,11 @@ find_vfunc_on_parent(GIObjectInfo *info,
      * to search the parent types when looking for a vfunc. */
     vfunc = g_object_info_find_vfunc_using_interfaces(parent, name, NULL);
     while (!vfunc && parent) {
-        old_parent = parent;
-        parent = g_object_info_get_parent(old_parent);
-        if (!parent)
-            break;
-
-        g_base_info_unref(old_parent);
-        vfunc = g_object_info_find_vfunc(parent, name);
+        GIObjectInfo *tmp = parent;
+        parent = g_object_info_get_parent(tmp);
+        g_base_info_unref(tmp);
+        if (parent)
+            vfunc = g_object_info_find_vfunc(parent, name);
     }
 
     if (parent)



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