im.pidgin.pidgin.khc.msnp15: 7d7423261298f25a608730d0d05f8b74b74e3108

khc at pidgin.im khc at pidgin.im
Fri Dec 28 02:21:10 EST 2007


-----------------------------------------------------------------
Revision: 7d7423261298f25a608730d0d05f8b74b74e3108
Ancestor: 6acc9ce81394f0a0db6b1433627a97d771a692c1
Author: khc at pidgin.im
Date: 2007-12-26T02:30:07
Branch: im.pidgin.pidgin.khc.msnp15

Modified files:
        libpurple/protocols/msn/msn.c
        libpurple/protocols/msn/nexus.c
        libpurple/protocols/msn/oim.c
        libpurple/protocols/msn/session.c
        libpurple/protocols/msn/soap2.c

ChangeLog: 

fixed a memleak or 3, or maybe 4, or 5. Some of these applies to the p14
code as well


-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msn.c	bb0de7cd52ec8ed9aa827db242e84131973de907
+++ libpurple/protocols/msn/msn.c	05fdb0985980faa093910341cec62b0cfb8fa06b
@@ -927,7 +927,10 @@ msn_send_im(PurpleConnection *gc, const 
 	}
 
 	msn_import_html(message, &msgformat, &msgtext);
-	if(msn_user_is_online(account, who)||
+	/* this is incorrect, we should try to initiate a connection to the
+	   buddy first, and only falls back if that fails. Otherwise we can
+	   only send offline message to invisible buddies */
+	if (msn_user_is_online(account, who)||
 		msn_user_is_yahoo(account, who)){
 		/*User online,then send Online Instant Message*/
 
@@ -994,7 +997,7 @@ msn_send_im(PurpleConnection *gc, const 
 		}
 
 		msn_message_destroy(msg);
-	}else	{
+	} else {
 		/*send Offline Instant Message,only to MSN Passport User*/
 		MsnSession *session;
 		char *friendname;
@@ -1005,8 +1008,11 @@ msn_send_im(PurpleConnection *gc, const 
 		friendname = msn_encode_mime(account->username);
 		msn_oim_prep_send_msg_info(session->oim,
 			purple_account_get_username(account),
-			friendname, who,	message);
+			friendname, who, msgformat);
 		msn_oim_send_msg(session->oim);
+
+		g_free(msgformat);
+		g_free(msgtext);
 		g_free(friendname);
 	}
 
============================================================
--- libpurple/protocols/msn/nexus.c	f347d0ebd6f1cbfa65663c257b30c09c16d38cdb
+++ libpurple/protocols/msn/nexus.c	73773939489c4e8a606049c3642aca072ca8f4d5
@@ -246,18 +246,19 @@ nexus_parse_response(MsnNexus *nexus, xm
 		xmlnode *expires = msn_soap_xml_get(node, "LifeTime/Expires");
 
 		if (token) {
-			char *token_str = xmlnode_get_data(token);
+			char *token_str, *expiry_str;
 			const char *id_str = xmlnode_get_attrib(token, "Id");
 			char **elems, **cur, **tokens;
 			int id;
 
-			if (token_str == NULL) continue;
 			if (id_str == NULL) continue;
 
 			id = atol(id_str + 7) - 1;	/* 'Compact#' or 'PPToken#' */
 			if (id >= nexus->token_len)
 				continue;	/* Where did this come from? */
 
+			token_str = xmlnode_get_data(token);
+			if (token_str == NULL) continue;
 			elems = g_strsplit(token_str, "&", 0);
 
 			for (cur = elems; *cur != NULL; cur++){
@@ -271,14 +272,18 @@ nexus_parse_response(MsnNexus *nexus, xm
 			g_strfreev(elems);
 
 			if (secret)
-				nexus->tokens[id].secret = g_strdup(xmlnode_get_data(secret));
+				nexus->tokens[id].secret = xmlnode_get_data(secret);
 			else
 				nexus->tokens[id].secret = NULL;
 
 			/* Yay for MS using ISO-8601 */
-			nexus->tokens[id].expiry = purple_str_to_time(xmlnode_get_data(expires),
-			                                              FALSE, NULL, NULL, NULL);
+			expiry_str = xmlnode_get_data(expires);
 
+			nexus->tokens[id].expiry = purple_str_to_time(expiry_str,
+				FALSE, NULL, NULL, NULL);
+
+			g_free(expiry_str);
+
 			purple_debug_info("msnp15", "Updated ticket for domain '%s'\n",
 			                  ticket_domains[id][SSO_VALID_TICKET_DOMAIN]);
 			result = TRUE;
============================================================
--- libpurple/protocols/msn/oim.c	763bfb4189bbaffafc2a75e73f0fdb107db6818b
+++ libpurple/protocols/msn/oim.c	fec2d8c9392060de37544b0e290cad99338369e8
@@ -161,6 +161,8 @@ msn_oim_send_read_cb(MsnSoapMessage *req
 					xmlnode *challengeNode = msn_soap_xml_get(faultNode,
 						"detail/LockKeyChallenge");
 
+					g_free(faultcode_str);
+
 					if (challengeNode == NULL) {
 						if (oim->challenge) {
 							g_free(oim->challenge);
============================================================
--- libpurple/protocols/msn/session.c	cd1943a62351aa34cb340359af0f90040ca74bfc
+++ libpurple/protocols/msn/session.c	7a7ed3e60d46ed0767831ce367b515cb8c6f6243
@@ -100,7 +100,7 @@ msn_session_destroy(MsnSession *session)
 	if (session->user != NULL)
 		msn_user_destroy(session->user);
 
-	if (session->soap_table)
+	if (session->soap_table != NULL)
 		g_hash_table_destroy(session->soap_table);
 
 	if (session->soap_cleanup_handle)
============================================================
--- libpurple/protocols/msn/soap2.c	cb00e41ad8b30ce91beca2d51c06edea71cdf389
+++ libpurple/protocols/msn/soap2.c	e0efef9501172e1cc109b1fdcc718f3f06b9df16
@@ -229,6 +229,7 @@ msn_soap_handle_body(MsnSoapConnection *
 				}
 
 				g_free(faultdata);
+				msn_soap_message_destroy(response);
 				return TRUE;
 			} else if (g_str_equal(faultdata, "wsse:FailedAuthentication")) {
 				xmlnode *reason = xmlnode_get_child(body, "faultstring");
@@ -240,6 +241,7 @@ msn_soap_handle_body(MsnSoapConnection *
 
 				g_free(reasondata);
 				g_free(faultdata);
+				msn_soap_message_destroy(response);
 				return FALSE;
 			}
 
@@ -252,6 +254,7 @@ msn_soap_handle_body(MsnSoapConnection *
 		conn->current_request = NULL;
 		request->cb(request->message, response,
 			request->cb_data);
+		msn_soap_message_destroy(response);
 		msn_soap_request_destroy(request);
 	}
 


More information about the Commits mailing list