[Telepathy-commits] [telepathy-glib/master] Attempt to fix a rather large leak in tp_presence_mixin_get_statuses()
Jonathon Jongsma
jonathon.jongsma at collabora.co.uk
Fri Jan 23 15:10:41 PST 2009
While valgrinding telepathy-idle with my new presence support and joining
various large freenode channels (e.g. #emacs, #vim, #ubuntu, etc), I got the
following valgrind message:
==16957== 134,989 (10,055 direct, 124,934 indirect) bytes in 746 blocks are definitely lost in loss record 12 of 13
==16957== at 0x4025D2E: malloc (vg_replace_malloc.c:207)
==16957== by 0x43893E8: g_malloc (gmem.c:131)
==16957== by 0x43A1DDC: g_slice_alloc (gslice.c:824)
==16957== by 0x436FCF6: g_hash_table_new_full (ghash.c:511)
==16957== by 0x436FCD2: g_hash_table_new (ghash.c:482)
==16957== by 0x4260B13: get_statuses_arguments (presence-mixin.c:541)
==16957== by 0x4260E3A: tp_presence_mixin_get_statuses (presence-mixin.c:606)
==16957== by 0x4277BE4: tp_svc_connection_interface_presence_get_statuses (tp-svc-connection.c:2042)
==16957== by 0x432419E: g_cclosure_marshal_VOID__POINTER (gmarshal.c:601)
==16957== by 0x42A60DD: gobject_message_function (dbus-gobject.c:1339)
==16957== by 0x42DF399: _dbus_object_tree_dispatch_and_unlock (dbus-object-tree.c:856)
==16957== by 0x42CE43F: dbus_connection_dispatch (dbus-connection.c:4447)
It appears that we're passing a dynamically allocated hash table (from
get_statuses_arguments()) to g_value_set_static_boxed(), leaking the hash table
every time we call GetStatuses(). After the following patch, I no longer get
this valgrind loss record (though I do get other massive losses from other areas
that need investigation)
---
telepathy-glib/presence-mixin.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/telepathy-glib/presence-mixin.c b/telepathy-glib/presence-mixin.c
index 04b4869..080f6e4 100644
--- a/telepathy-glib/presence-mixin.c
+++ b/telepathy-glib/presence-mixin.c
@@ -603,7 +603,7 @@ tp_presence_mixin_get_statuses (TpSvcConnectionInterfacePresence *iface,
g_value_array_append (status, NULL);
g_value_init (g_value_array_get_nth (status, 3),
DBUS_TYPE_G_STRING_STRING_HASHTABLE);
- g_value_set_static_boxed (g_value_array_get_nth (status, 3),
+ g_value_take_boxed (g_value_array_get_nth (status, 3),
get_statuses_arguments (mixin_cls->statuses[i].optional_arguments));
g_hash_table_insert (ret, (gchar *) mixin_cls->statuses[i].name,
--
1.5.6.5
More information about the Telepathy-commits
mailing list