[pygobject] Plug memory leak in _is_union_member



commit 4824ceaa77b59788325a2c1ee0f994d4e74d7a1c
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Mar 4 16:41:18 2012 +0100

    Plug memory leak in _is_union_member
    
    When we found the member, unref the objects before breaking out of the
    loop.

 gi/pygi-marshal-from-py.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/gi/pygi-marshal-from-py.c b/gi/pygi-marshal-from-py.c
index 4de874b..adb1cc7 100644
--- a/gi/pygi-marshal-from-py.c
+++ b/gi/pygi-marshal-from-py.c
@@ -61,21 +61,18 @@ _is_union_member (PyGIInterfaceCache *iface_cache, PyObject *py_arg) {
 
         /* we can only check if the members are interfaces */
         if (g_type_info_get_tag (field_type_info) == GI_TYPE_TAG_INTERFACE) {
+            GIInterfaceInfo *field_iface_info;
             PyObject *py_type;
-            GIInterfaceInfo *field_iface_info =
-                g_type_info_get_interface (field_type_info);
 
-            py_type = _pygi_type_import_by_gi_info (
-                (GIBaseInfo *) field_iface_info);
+            field_iface_info = g_type_info_get_interface (field_type_info);
+            py_type = _pygi_type_import_by_gi_info ((GIBaseInfo *) field_iface_info);
 
             if (py_type != NULL && PyObject_IsInstance (py_arg, py_type)) {
                 is_member = TRUE;
-                break;
             }
 
             Py_XDECREF (py_type);
             g_base_info_unref ( ( GIBaseInfo *) field_iface_info);
-
         }
 
         g_base_info_unref ( ( GIBaseInfo *) field_type_info);



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