changeset 31037:0d5e038911a7

Correct the ref counts on the SlpMsgParts. When it's removed from the list in the slpmsg, it should be unref'd, and when it's queued, it should be ref'd. That should fix the leaks HanzZ saw. Refs #13084.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 16 Dec 2010 00:14:49 +0000
parents 05e05d96ba75
children 7d980d6b40e1
files libpurple/protocols/msn/directconn.c libpurple/protocols/msn/slpmsg_part.c
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/directconn.c	Wed Dec 15 23:10:13 2010 +0000
+++ b/libpurple/protocols/msn/directconn.c	Thu Dec 16 00:14:49 2010 +0000
@@ -552,7 +552,7 @@
 	memcpy(p->data + P2P_PACKET_HEADER_SIZE, part->buffer, part->size);
 
 	p->sent_cb = msn_dc_send_packet_cb;
-	p->part = part;
+	p->part = msn_slpmsgpart_ref(part);
 
 	msn_dc_enqueue_packet(dc, p);
 }
--- a/libpurple/protocols/msn/slpmsg_part.c	Wed Dec 15 23:10:13 2010 +0000
+++ b/libpurple/protocols/msn/slpmsg_part.c	Thu Dec 16 00:14:49 2010 +0000
@@ -183,6 +183,7 @@
 	slpmsg->header->offset += part->header->length;
 
 	slpmsg->parts = g_list_remove(slpmsg->parts, part);
+	msn_slpmsgpart_unref(part);
 
 	if (slpmsg->header->offset < real_size)
 	{
@@ -220,5 +221,6 @@
 	msn_slplink_send_msgpart(slpmsg->slplink, slpmsg);
 
 	slpmsg->parts = g_list_remove(slpmsg->parts, part);
+	msn_slpmsgpart_unref(part);
 }