changeset 31376:2de522fa534a

Fix a lot more leaks, some old, some new.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 21 Nov 2010 09:56:48 +0000
parents 4e097dfb7784
children 8714c0bfa52a
files libpurple/protocols/msn/directconn.c libpurple/protocols/msn/msg.c libpurple/protocols/msn/msn.c libpurple/protocols/msn/notification.c libpurple/protocols/msn/object.c libpurple/protocols/msn/sbconn.c libpurple/protocols/msn/slpcall.c libpurple/protocols/msn/slplink.c libpurple/protocols/msn/slpmsg_part.c libpurple/protocols/msn/switchboard.c
diffstat 10 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/directconn.c	Sun Nov 21 08:47:08 2010 +0000
+++ b/libpurple/protocols/msn/directconn.c	Sun Nov 21 09:56:48 2010 +0000
@@ -633,6 +633,7 @@
 		if (dc->header.length) {
 			part = msn_slpmsgpart_new_from_data(dc->in_buffer + 4, dc->header.length);
 			msn_slplink_process_msg(dc->slplink, part);
+			msn_slpmsgpart_destroy(part);
 		}
 
 		/*
--- a/libpurple/protocols/msn/msg.c	Sun Nov 21 08:47:08 2010 +0000
+++ b/libpurple/protocols/msn/msg.c	Sun Nov 21 09:56:48 2010 +0000
@@ -368,6 +368,8 @@
 
 		memcpy(n, body, siz);
 		n += siz;
+
+		g_free(body);
 	}
 	else
 	{
--- a/libpurple/protocols/msn/msn.c	Sun Nov 21 08:47:08 2010 +0000
+++ b/libpurple/protocols/msn/msn.c	Sun Nov 21 09:56:48 2010 +0000
@@ -1446,6 +1446,7 @@
 	}
 
 	msn_switchboard_send_msg(swboard, msg, TRUE);
+	msn_message_destroy(msg);
 }
 
 static int
@@ -2081,6 +2082,7 @@
 		trans = msn_transaction_new(cmdproc, "PNG", NULL);
 		msn_transaction_set_saveable(trans, FALSE);
 		msn_cmdproc_send_trans(cmdproc, trans);
+		msn_transaction_destroy(trans);
 	}
 }
 
--- a/libpurple/protocols/msn/notification.c	Sun Nov 21 08:47:08 2010 +0000
+++ b/libpurple/protocols/msn/notification.c	Sun Nov 21 09:56:48 2010 +0000
@@ -309,6 +309,7 @@
 	trans = msn_transaction_new(notification->cmdproc, "OUT", NULL);
 	msn_transaction_set_saveable(trans, FALSE);
 	msn_cmdproc_send_trans(notification->cmdproc, trans);
+	msn_transaction_destroy(trans);
 
 	msn_notification_disconnect(notification);
 }
--- a/libpurple/protocols/msn/object.c	Sun Nov 21 08:47:08 2010 +0000
+++ b/libpurple/protocols/msn/object.c	Sun Nov 21 09:56:48 2010 +0000
@@ -202,6 +202,8 @@
 	g_free(obj->friendly);
 	g_free(obj->sha1d);
 	g_free(obj->sha1c);
+	g_free(obj->url);
+	g_free(obj->url1);
 
 	purple_imgstore_unref(obj->img);
 
--- a/libpurple/protocols/msn/sbconn.c	Sun Nov 21 08:47:08 2010 +0000
+++ b/libpurple/protocols/msn/sbconn.c	Sun Nov 21 09:56:48 2010 +0000
@@ -16,10 +16,10 @@
 	passport = purple_normalize(slplink->session->account, slplink->remote_user);
 	msn_message_set_header(msg, "P2P-Dest", passport);
 
+	msg->part = msn_slpmsgpart_ref(part);
 	data = msn_slpmsgpart_serialize(part, &size);
-	msg->part = msn_slpmsgpart_ref(part);
-
 	msn_message_set_bin_data(msg, data, size);
+	g_free(data);
 
 	if (slplink->swboard == NULL)
 	{
@@ -33,6 +33,7 @@
 	}
 
 	msn_switchboard_send_msg(slplink->swboard, msg, TRUE);
+	msn_message_destroy(msg);
 }
 
 /** Called when a message times out. */
--- a/libpurple/protocols/msn/slpcall.c	Sun Nov 21 08:47:08 2010 +0000
+++ b/libpurple/protocols/msn/slpcall.c	Sun Nov 21 09:56:48 2010 +0000
@@ -826,6 +826,7 @@
 
 		/* Try direct file transfer by sending a second INVITE */
 		dc = msn_dc_new(slpcall);
+		g_free(slpcall->branch);
 		slpcall->branch = rand_guid();
 
 		dc->listen_data = purple_network_listen_range(
--- a/libpurple/protocols/msn/slplink.c	Sun Nov 21 08:47:08 2010 +0000
+++ b/libpurple/protocols/msn/slplink.c	Sun Nov 21 09:56:48 2010 +0000
@@ -502,7 +502,6 @@
 	slpcall = msn_slp_process_msg(slplink, slpmsg);
 
 	if (slpcall == NULL) {
-		msn_slpmsg_destroy(slpmsg);
 		return;
 	}
 
@@ -541,8 +540,6 @@
 		}
 	}
 
-	msn_slpmsg_destroy(slpmsg);
-
 	if (!slpcall->wait_for_socket && slpcall->wasted)
 		msn_slpcall_destroy(slpcall);
 }
@@ -625,6 +622,8 @@
 	/* All the pieces of the slpmsg have been received */
 	if (header->offset + header->length >= header->total_size)
 		process_complete_msg(slplink, slpmsg, header);
+
+	msn_slpmsg_destroy(slpmsg);
 }
 
 void
--- a/libpurple/protocols/msn/slpmsg_part.c	Sun Nov 21 08:47:08 2010 +0000
+++ b/libpurple/protocols/msn/slpmsg_part.c	Sun Nov 21 09:56:48 2010 +0000
@@ -109,8 +109,7 @@
 {
 	g_return_if_fail(part != NULL);
 
-	if (part->buffer != NULL)
-		g_free(part->buffer);
+	g_free(part->buffer);
 
 	if (data != NULL && len > 0) {
 		part->buffer = g_malloc(len + 1);
--- a/libpurple/protocols/msn/switchboard.c	Sun Nov 21 08:47:08 2010 +0000
+++ b/libpurple/protocols/msn/switchboard.c	Sun Nov 21 09:56:48 2010 +0000
@@ -1147,6 +1147,7 @@
 		trans = msn_transaction_new(cmdproc, "OUT", NULL);
 		msn_transaction_set_saveable(trans, FALSE);
 		msn_cmdproc_send_trans(cmdproc, trans);
+		msn_transaction_destroy(trans);
 
 		msn_switchboard_destroy(swboard);
 	}