Possible memory leak in pygi-invoke.c



Hello,

   Using PyGI in my code, I notice that each function call costs memory
that is not released after. In my opinion,
the function _wrap_g_function_info_invoke() does not free memory
allocated in the structure "state" in case of working status, while
_free_invocation_state() is indeed call in case of error. I suggest to
call the _free routine before the return line, as done in the attached
patch.

   What do you think ?

Damien.
diff --git a/gi/pygi-invoke.c b/gi/pygi-invoke.c
index 52fddcf..f1a621e 100644
--- a/gi/pygi-invoke.c
+++ b/gi/pygi-invoke.c
@@ -911,6 +911,7 @@ _wrap_g_function_info_invoke (PyGIBaseInfo *self, PyObject *py_args)
         return NULL;
     }
 
+    _free_invocation_state (&state);
     return state.return_value;
 }
 


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