[pygobject] Don't dup strings before passing them to type registration functions
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Don't dup strings before passing them to type registration functions
- Date: Thu, 20 Dec 2012 08:53:30 +0000 (UTC)
commit 53bc12a87da824cbfb006a4fd65731edec12ecc7
Author: Mike Gorse <mgorse suse com>
Date: Wed Dec 19 20:51:03 2012 -0500
Don't dup strings before passing them to type registration functions
Strings passed to g_enum_register_static and g_flags_register_static are
eventually passed to g_quark_from_string, which dups the string passed to it if
needed and does not take ownership of it, so passing in a dynamically-allocated
string without freeing it results in a small leak.
https://bugzilla.gnome.org/show_bug.cgi?id=690532
gi/gimodule.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
---
diff --git a/gi/gimodule.c b/gi/gimodule.c
index 76530f1..f5c0026 100644
--- a/gi/gimodule.c
+++ b/gi/gimodule.c
@@ -110,7 +110,6 @@ _wrap_pyg_enum_register_new_gtype_and_add (PyObject *self,
g_enum_values[n_values].value_name = NULL;
type_name = g_base_info_get_name ((GIBaseInfo *) info);
- type_name = g_strdup (type_name);
g_type = g_enum_register_static (type_name, g_enum_values);
return pyg_enum_add (NULL, g_type_name (g_type), NULL, g_type);
@@ -198,7 +197,6 @@ _wrap_pyg_flags_register_new_gtype_and_add (PyObject *self,
g_flags_values[n_values].value_name = NULL;
type_name = g_base_info_get_name ((GIBaseInfo *) info);
- type_name = g_strdup (type_name);
g_type = g_flags_register_static (type_name, g_flags_values);
return pyg_flags_add (NULL, g_type_name (g_type), NULL, g_type);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]