From 7e4a554d61314eca12247b419080e7a09f5b3309 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Thu, 30 Apr 2009 14:58:23 +0000 Subject: Fix leak in python binding * bindings/python/wrapper_top.c: keep a pointer on beginning of list to free it. --- bindings/python/wrapper_top.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bindings/python') diff --git a/bindings/python/wrapper_top.c b/bindings/python/wrapper_top.c index 8c2d584a..e71c5fa2 100644 --- a/bindings/python/wrapper_top.c +++ b/bindings/python/wrapper_top.c @@ -46,14 +46,14 @@ noneRef() { static PyObject* get_dict_from_hashtable_of_objects(GHashTable *value) { - GList *keys; + GList *keys, *begin; PyObject *dict,*proxy; GObject *item_value; PyObject *item; dict = PyDict_New(); - keys = g_hash_table_get_keys(value); + begin = keys = g_hash_table_get_keys(value); for (; keys; keys = g_list_next(keys)) { item_value = g_hash_table_lookup(value, keys->data); if (item_value) { @@ -64,7 +64,7 @@ get_dict_from_hashtable_of_objects(GHashTable *value) PyErr_Warn(PyExc_RuntimeWarning, "hashtable contains a null value"); } } - g_list_free(keys); + g_list_free(begin); proxy = PyDictProxy_New(dict); Py_DECREF(dict); -- cgit