[Telepathy-commits] [telepathy-idle/master] Fix a leak in change_tp_properties()

Jonathon Jongsma jonathon.jongsma at collabora.co.uk
Fri Feb 13 17:43:17 PST 2009


We were leaking all GValue* objects that we got with dbus_g_type_struct_get()
every time we called change_tp_properties().  This valgrind error is
representative of the leaks:

==2405== 1,348 (280 direct, 1,068 indirect) bytes in 14 blocks are definitely lost in loss record 5 of 15
==2405==    at 0x4023DE2: calloc (vg_replace_malloc.c:397)
==2405==    by 0x4389479: g_malloc0 (gmem.c:151)
==2405==    by 0x43060A1: value_copy (gboxed.c:94)
==2405==    by 0x43069CE: boxed_proxy_lcopy_value (gboxed.c:362)
==2405==    by 0x42B08C5: dbus_g_type_struct_get (dbus-gtype-specialized.c:978)
==2405==    by 0x805D1EC: change_tp_properties (idle-muc-channel.c:526)
==2405==    by 0x805F39D: idle_muc_channel_topic (idle-muc-channel.c:1222)
==2405==    by 0x8053969: _numeric_topic_handler (idle-muc-factory.c:184)
==2405==    by 0x8055F5D: _parse_and_forward_one (idle-parser.c:399)
==2405==    by 0x8055BC7: _parse_message (idle-parser.c:321)
==2405==    by 0x8055694: idle_parser_receive (idle-parser.c:214)
==2405==    by 0x804EFF6: sconn_received_cb (idle-connection.c:656)

After this commit, this particular error message no longer appears, though there
is one additional leak that I need to chase down yet.
---
 src/idle-muc-channel.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/idle-muc-channel.c b/src/idle-muc-channel.c
index ea394a0..85e1bcd 100644
--- a/src/idle-muc-channel.c
+++ b/src/idle-muc-channel.c
@@ -543,6 +543,8 @@ static void change_tp_properties(IdleMUCChannel *chan, const GPtrArray *props) {
 
 			IDLE_DEBUG("tp_property %u changed", prop_id);
 		}
+		g_value_unset(new_val);
+		g_free(new_val);
 
 		g_value_unset(&prop);
 	}
-- 
1.5.6.5




More information about the telepathy-commits mailing list