changeset 20500:403ff626b803

merge of '0d182c079b200633b234b9a8216aba155384f21b' and 'f1386de039f67a9907085baf097986700135cac6'
author Ka-Hing Cheung <khc@hxbc.us>
date Sun, 09 Sep 2007 00:50:14 +0000
parents 6ef43e723595 (current diff) 7e7add38a02f (diff)
children f6dff814d95f
files libpurple/protocols/msn/oim.c
diffstat 4 files changed, 30 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c	Sun Sep 09 00:46:16 2007 +0000
+++ b/libpurple/protocols/msn/contact.c	Sun Sep 09 00:50:14 2007 +0000
@@ -415,6 +415,7 @@
 
 		if ( (typedata = xmlnode_get_data(handletype)) == NULL) {
 			purple_debug_error("MSNCL","Error retrieving data from 'Type' child node\n");
+			g_free(typedata);
 			continue;
 		}
 
@@ -655,9 +656,7 @@
 		xmlnode *groupIds;
 		MsnUser *user;
 		MsnUserType usertype;
-		char *passport,*Name,*uid,*type;
-
-		passport = NULL;
+		char *passport = NULL, *Name = NULL, *uid = NULL, *type = NULL;
 
 		contactId= xmlnode_get_child(contactNode,"contactId");
 		uid = xmlnode_get_data(contactId);
@@ -696,6 +695,8 @@
 					contactEmailNode = xmlnode_get_next_twin(contactEmailNode) ){
 				messengerEnabledNode = xmlnode_get_child(contactEmailNode,"isMessengerEnabled");
 				if(messengerEnabledNode == NULL){
+					g_free(uid);
+					g_free(type);
 					break;
 				}
 				msnEnabled = xmlnode_get_data(messengerEnabledNode);
@@ -705,6 +706,10 @@
 					passport = xmlnode_get_data(emailNode);
 					purple_debug_info("MsnAB","Yahoo User %s\n",passport);
 					usertype = MSN_USER_TYPE_YAHOO;
+					g_free(uid);
+					g_free(type);
+					g_free(passport);
+					g_free(msnEnabled);
 					break;
 				}else{
 					/*TODO maybe we can just ignore it in Purple?*/
@@ -728,7 +733,7 @@
 		if (displayName == NULL) {
 			Name = g_strdup(passport);
 		} else {
-			Name =xmlnode_get_data(displayName);
+			Name = xmlnode_get_data(displayName);
 		}
 
 		purple_debug_misc("MsnAB","passport:{%s} uid:{%s} display:{%s}\n",
--- a/libpurple/protocols/msn/notification.c	Sun Sep 09 00:46:16 2007 +0000
+++ b/libpurple/protocols/msn/notification.c	Sun Sep 09 00:50:14 2007 +0000
@@ -1625,7 +1625,7 @@
 	PurpleConnection *gc;
 	MsnUser *user;
 	const char *passport;
-	char *psm_str, *currentmedia_str;
+	char *psm_str, *currentmedia_str, *str;
 
 	/*get the payload content*/
 //	purple_debug_info("MSNP14","UBX {%s} payload{%s}\n",cmd->params[0], cmd->payload);
@@ -1639,7 +1639,8 @@
 	
 	psm_str = msn_get_psm(cmd->payload,len);
 	currentmedia_str = msn_parse_currentmedia(
-	                                 msn_get_currentmedia(cmd->payload, len));
+	                                 str = msn_get_currentmedia(cmd->payload, len));
+	g_free(str);
 
 	msn_user_set_statusline(user, psm_str);
 	msn_user_set_currentmedia(user, currentmedia_str);
--- a/libpurple/protocols/msn/oim.c	Sun Sep 09 00:46:16 2007 +0000
+++ b/libpurple/protocols/msn/oim.c	Sun Sep 09 00:50:14 2007 +0000
@@ -168,7 +168,7 @@
 	xmlnode *responseNode, *bodyNode;
 	xmlnode	*faultNode, *faultCodeNode, *faultstringNode;
 	xmlnode *detailNode, *challengeNode;
-	char *faultCodeStr, *faultstring;
+	char *faultCodeStr = NULL, *faultstring = NULL;
 
 	responseNode = xmlnode_from_str(body,len);
 	g_return_if_fail(responseNode != NULL);
@@ -226,6 +226,8 @@
 	msn_oim_send_msg(oim);
 
 oim_send_process_fail:
+	g_free(faultstring);
+	g_free(faultCodeStr);
 	xmlnode_free(responseNode);
 	return ;
 }
@@ -548,20 +550,19 @@
 static void
 msn_oim_get_process(MsnOim *oim, const char *oim_msg)
 {
-	xmlnode *oimNode,*bodyNode,*responseNode,*msgNode;
-	char *msg_data,*msg_str;
+	xmlnode *oim_node,*bodyNode,*responseNode,*msgNode;
+	char *msg_str;
 
-	oimNode = xmlnode_from_str(oim_msg, strlen(oim_msg));
-	bodyNode = xmlnode_get_child(oimNode,"Body");
+	oim_node = xmlnode_from_str(oim_msg, strlen(oim_msg));
+	bodyNode = xmlnode_get_child(oim_node,"Body");
 	responseNode = xmlnode_get_child(bodyNode,"GetMessageResponse");
 	msgNode = xmlnode_get_child(responseNode,"GetMessageResult");
-	msg_data = xmlnode_get_data(msgNode);
-	msg_str = g_strdup(msg_data);
-	g_free(msg_data);
+	msg_str = xmlnode_get_data(msgNode);
 	purple_debug_info("OIM","msg:{%s}\n",msg_str);
 	msn_oim_report_to_user(oim,msg_str);
 
 	g_free(msg_str);
+	xmlnode_free(oim_node);
 }
 
 static void
@@ -655,6 +656,7 @@
 		rTime = NULL;
 		g_free(nickname);
 	}
+	g_free(unread);
 	xmlnode_free(node);
 }
 
--- a/libpurple/protocols/msn/state.c	Sun Sep 09 00:46:16 2007 +0000
+++ b/libpurple/protocols/msn/state.c	Sun Sep 09 00:50:14 2007 +0000
@@ -156,7 +156,7 @@
 msn_get_currentmedia(char *xml_str, gsize len)
 {
 	xmlnode *payloadNode, *currentmediaNode;
-	char *currentmedia_str, *currentmedia;
+	char *currentmedia;
 	
 	purple_debug_info("msn","msn get CurrentMedia\n");
 	payloadNode = xmlnode_from_str(xml_str, len);
@@ -167,14 +167,12 @@
 	currentmediaNode = xmlnode_get_child(payloadNode, "CurrentMedia");
 	if (currentmediaNode == NULL){
 		purple_debug_info("msn","No CurrentMedia Node");
-		g_free(payloadNode);
+		xmlnode_free(payloadNode);
 		return NULL;
 	}
-	currentmedia_str = xmlnode_get_data(currentmediaNode);
-	currentmedia = g_strdup(currentmedia_str);
+	currentmedia = xmlnode_get_data(currentmediaNode);
 
-	g_free(currentmediaNode);
-	g_free(payloadNode);
+	xmlnode_free(payloadNode);
 
 	return currentmedia;
 }
@@ -184,7 +182,7 @@
 msn_get_psm(char *xml_str, gsize len)
 {
 	xmlnode *payloadNode, *psmNode;
-	char *psm_str, *psm;
+	char *psm;
 	
 	purple_debug_info("MSNP14","msn get PSM\n");
 	payloadNode = xmlnode_from_str(xml_str, len);
@@ -195,14 +193,12 @@
 	psmNode = xmlnode_get_child(payloadNode, "PSM");
 	if (psmNode == NULL){
 		purple_debug_info("MSNP14","No PSM status Node");
-		g_free(payloadNode);
+		xmlnode_free(payloadNode);
 		return NULL;
 	}
-	psm_str = xmlnode_get_data(psmNode);
-	psm = g_strdup(psm_str);
+	psm = xmlnode_get_data(psmNode);
 
-	g_free(psmNode);
-	g_free(payloadNode);
+	xmlnode_free(payloadNode);
 
 	return psm;
 }