Correct the ref counts on the SlpMsgParts. When it's removed from the

Thu, 16 Dec 2010 00:14:49 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Thu, 16 Dec 2010 00:14:49 +0000
changeset 31241
cc8a2c660694
parent 31240
db0cb3d72bc9
child 31242
ccda3dbc05e0

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.

libpurple/protocols/msn/directconn.c file | annotate | diff | comparison | revisions
libpurple/protocols/msn/slpmsg_part.c file | annotate | diff | comparison | revisions
--- 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);
 }
 

mercurial