pidgin: a3f22a3c: Fix a lot more leaks, some old, some new...

qulogic at pidgin.im qulogic at pidgin.im
Sun Nov 21 05:07:40 EST 2010


----------------------------------------------------------------------
Revision: a3f22a3cf406cfe814afbcdbc5e6ff17144f972f
Parent:   8e4543015b56f63d3d682112e6882a3bdeaed550
Author:   qulogic at pidgin.im
Date:     11/21/10 04:56:48
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/a3f22a3cf406cfe814afbcdbc5e6ff17144f972f

Changelog: 

Fix a lot more leaks, some old, some new.

Changes against parent 8e4543015b56f63d3d682112e6882a3bdeaed550

  patched  libpurple/protocols/msn/directconn.c
  patched  libpurple/protocols/msn/msg.c
  patched  libpurple/protocols/msn/msn.c
  patched  libpurple/protocols/msn/notification.c
  patched  libpurple/protocols/msn/object.c
  patched  libpurple/protocols/msn/sbconn.c
  patched  libpurple/protocols/msn/slpcall.c
  patched  libpurple/protocols/msn/slplink.c
  patched  libpurple/protocols/msn/slpmsg_part.c
  patched  libpurple/protocols/msn/switchboard.c

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msn.c	e1626b774213ff03db8f979335abc4ee27a31395
+++ libpurple/protocols/msn/msn.c	7db0124e32dd902f565a5f62d6db602eaa71a28b
@@ -1446,6 +1446,7 @@ msn_send_im_message(MsnSession *session,
 	}
 
 	msn_switchboard_send_msg(swboard, msg, TRUE);
+	msn_message_destroy(msg);
 }
 
 static int
@@ -2081,6 +2082,7 @@ msn_keepalive(PurpleConnection *gc)
 		trans = msn_transaction_new(cmdproc, "PNG", NULL);
 		msn_transaction_set_saveable(trans, FALSE);
 		msn_cmdproc_send_trans(cmdproc, trans);
+		msn_transaction_destroy(trans);
 	}
 }
 
============================================================
--- libpurple/protocols/msn/msg.c	eabe161384ac4e8e4fdb5c116b3c904578f5dd92
+++ libpurple/protocols/msn/msg.c	dd9cf9291e148ae087fc8d09964ef2494d4f7312
@@ -368,6 +368,8 @@ msn_message_gen_payload(MsnMessage *msg,
 
 		memcpy(n, body, siz);
 		n += siz;
+
+		g_free(body);
 	}
 	else
 	{
============================================================
--- libpurple/protocols/msn/switchboard.c	57d24ccb7e02abc33d647978df205ca1b61709a1
+++ libpurple/protocols/msn/switchboard.c	1787991241f367c297a7a6d7fa22a588de78fc95
@@ -1147,6 +1147,7 @@ msn_switchboard_close(MsnSwitchBoard *sw
 		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);
 	}
============================================================
--- libpurple/protocols/msn/notification.c	d92c9a3379254840c21d8230b52f0c9ec5547f0e
+++ libpurple/protocols/msn/notification.c	8991cf51fab03da5b5c8e995fed749ef1347efdd
@@ -309,6 +309,7 @@ msn_notification_close(MsnNotification *
 	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);
 }
============================================================
--- libpurple/protocols/msn/directconn.c	58775caeb9861aa36c95f2a2af61335a90c8518a
+++ libpurple/protocols/msn/directconn.c	243d41c900e7bf69fe5a56234577b85553a1b3aa
@@ -633,6 +633,7 @@ msn_dc_process_packet(MsnDirectConn *dc,
 		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);
 		}
 
 		/*
============================================================
--- libpurple/protocols/msn/object.c	5721ffca389b5ad7fad9e8f93592a98da19a602c
+++ libpurple/protocols/msn/object.c	6b22e0106c25a790cf9b997ba57ba326d285751b
@@ -202,6 +202,8 @@ msn_object_destroy(MsnObject *obj)
 	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);
 
============================================================
--- libpurple/protocols/msn/slpcall.c	85b91da8dfc47ecf064fba39336efaa1686afc54
+++ libpurple/protocols/msn/slpcall.c	e2fd60e824da0f700d0c0deef15f3848b7ccaad1
@@ -826,6 +826,7 @@ got_ok(MsnSlpCall *slpcall,
 
 		/* 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(
============================================================
--- libpurple/protocols/msn/slplink.c	063dca5e33225dc91680f5283acdee237af24e28
+++ libpurple/protocols/msn/slplink.c	b7a13d7e3ff94d2e98bc033168f4a7d126920932
@@ -502,7 +502,6 @@ process_complete_msg(MsnSlpLink *slplink
 	slpcall = msn_slp_process_msg(slplink, slpmsg);
 
 	if (slpcall == NULL) {
-		msn_slpmsg_destroy(slpmsg);
 		return;
 	}
 
@@ -541,8 +540,6 @@ process_complete_msg(MsnSlpLink *slplink
 		}
 	}
 
-	msn_slpmsg_destroy(slpmsg);
-
 	if (!slpcall->wait_for_socket && slpcall->wasted)
 		msn_slpcall_destroy(slpcall);
 }
@@ -625,6 +622,8 @@ msn_slplink_process_msg(MsnSlpLink *slpl
 	/* 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
============================================================
--- libpurple/protocols/msn/sbconn.c	1f7a807c21e550c747ae1deab078ec36aca48a38
+++ libpurple/protocols/msn/sbconn.c	0d90c026f464b6d9632bffcb549204f46ac5f02c
@@ -16,10 +16,10 @@ void msn_sbconn_send_part(MsnSlpLink *sl
 	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 @@ void msn_sbconn_send_part(MsnSlpLink *sl
 	}
 
 	msn_switchboard_send_msg(slplink->swboard, msg, TRUE);
+	msn_message_destroy(msg);
 }
 
 /** Called when a message times out. */
============================================================
--- libpurple/protocols/msn/slpmsg_part.c	09d7aae39c1436eeb63d500ce29149baa8c5952e
+++ libpurple/protocols/msn/slpmsg_part.c	61b8314f8b0be2f3c387b36abdb740880939e5a9
@@ -109,8 +109,7 @@ void msn_slpmsgpart_set_bin_data(MsnSlpM
 {
 	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);


More information about the Commits mailing list