diff options
author | Gian Mario Tagliaretti <gianmt@src.gnome.org> | 2009-02-08 19:18:48 +0000 |
---|---|---|
committer | Gian Mario Tagliaretti <gianmt@src.gnome.org> | 2009-02-08 19:18:48 +0000 |
commit | 8392f3d238484832a5d73a4602aad31f83a08f62 (patch) | |
tree | 15e34d4e120b98d05216b2fab501c30bb50ac190 /gobject/pygobject.c | |
parent | 951050a809d4368ed6fba283feffca0e7f6d8607 (diff) | |
download | pygobject-8392f3d238484832a5d73a4602aad31f83a08f62.tar.gz pygobject-8392f3d238484832a5d73a4602aad31f83a08f62.tar.xz pygobject-8392f3d238484832a5d73a4602aad31f83a08f62.zip |
huge patch to fix memory leaks all over the place, fixes #568427
svn path=/trunk/; revision=1002
Diffstat (limited to 'gobject/pygobject.c')
-rw-r--r-- | gobject/pygobject.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gobject/pygobject.c b/gobject/pygobject.c index c2deb9c..25efc52 100644 --- a/gobject/pygobject.c +++ b/gobject/pygobject.c @@ -231,18 +231,19 @@ build_parameter_list(GObjectClass *class) GParamSpec **props; guint n_props = 0, i; PyObject *prop_str; - char *name; PyObject *props_list; props = g_object_class_list_properties(class, &n_props); props_list = PyList_New(n_props); for (i = 0; i < n_props; i++) { + char *name; name = g_strdup(g_param_spec_get_name(props[i])); /* hyphens cannot belong in identifiers */ g_strdelimit(name, "-", '_'); prop_str = _PyUnicode_FromString(name); PyList_SetItem(props_list, i, prop_str); + g_free(name); } if (props) @@ -400,12 +401,14 @@ static Py_ssize_t PyGProps_length(PyGProps *self) { GObjectClass *class; + GParamSpec **props; guint n_props; class = g_type_class_ref(self->gtype); - g_object_class_list_properties(class, &n_props); + props = g_object_class_list_properties(class, &n_props); g_type_class_unref(class); - + g_free(props); + return (Py_ssize_t)n_props; } |