im.pidgin.pidgin: a3511433f0830f88e2e470b22fd2c706e2aa7713

datallah at pidgin.im datallah at pidgin.im
Sun Oct 14 20:35:41 EDT 2007


-----------------------------------------------------------------
Revision: a3511433f0830f88e2e470b22fd2c706e2aa7713
Ancestor: f4cb0b01008f7485ff8e336ba2be02072dfef04e
Author: datallah at pidgin.im
Date: 2007-10-15T00:31:34
Branch: im.pidgin.pidgin

Modified files:
        libpurple/protocols/msn/httpconn.c
        libpurple/protocols/msn/msg.c
        libpurple/protocols/msn/notification.c

ChangeLog: 

Fix some leaks.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/httpconn.c	80e256bd3fbf0787b129c1550808cc1237754211
+++ libpurple/protocols/msn/httpconn.c	c4c210f629cd20af9979a7f683f2da5af87e479d
@@ -169,7 +169,7 @@ msn_httpconn_parse_data(MsnHttpConn *htt
 	/* Now we should be able to process the data. */
 	if ((s = purple_strcasestr(header, "X-MSN-Messenger: ")) != NULL)
 	{
-		char *full_session_id, *gw_ip, *session_action;
+		gchar *full_session_id = NULL, *gw_ip = NULL, *session_action = NULL;
 		char *t, *session_id;
 		char **elems, **cur, **tokens;
 
@@ -196,13 +196,16 @@ msn_httpconn_parse_data(MsnHttpConn *htt
 		{
 			tokens = g_strsplit(*cur, "=", 2);
 
-			if (strcmp(tokens[0], "SessionID") == 0)
+			if (strcmp(tokens[0], "SessionID") == 0) {
+				g_free(full_session_id);
 				full_session_id = tokens[1];
-			else if (strcmp(tokens[0], "GW-IP") == 0)
+			} else if (strcmp(tokens[0], "GW-IP") == 0) {
+				g_free(gw_ip);
 				gw_ip = tokens[1];
-			else if (strcmp(tokens[0], "Session") == 0)
+			} else if (strcmp(tokens[0], "Session") == 0) {
+				g_free(session_action);
 				session_action = tokens[1];
-			else
+			} else
 				g_free(tokens[1]);
 
 			g_free(tokens[0]);
============================================================
--- libpurple/protocols/msn/msg.c	19e687b07ad0554378eb2b7a167c722914a9abd8
+++ libpurple/protocols/msn/msg.c	be278ff1429ee99bf96b26105834592f1a166367
@@ -664,10 +664,11 @@ msn_message_get_hashtable_from_body(cons
 
 		tokens = g_strsplit(*cur, ": ", 2);
 
-		if (tokens[0] != NULL && tokens[1] != NULL)
+		if (tokens[0] != NULL && tokens[1] != NULL) {
 			g_hash_table_insert(table, tokens[0], tokens[1]);
-
-		g_free(tokens);
+			g_free(tokens);
+		} else
+			g_strfreev(tokens);
 	}
 
 	g_strfreev(elems);
============================================================
--- libpurple/protocols/msn/notification.c	a6e46d83ce481d80c7c70279d95b373f44afa911
+++ libpurple/protocols/msn/notification.c	1db5caf58bcabfadb11d92dcef06e4aa5623e4d9
@@ -262,14 +262,15 @@ usr_cmd(MsnCmdProc *cmdproc, MsnCommand 
 		for (cur = elems; *cur != NULL; cur++)
 		{
 			tokens = g_strsplit(*cur, "=", 2);
-			if(tokens[0]&&tokens[1])
+			if(tokens[0] && tokens[1])
 			{
 				purple_debug_info("MSNP14","challenge %p,key:%s,value:%s\n",
 									session->nexus->challenge_data,tokens[0],tokens[1]);
 				g_hash_table_insert(session->nexus->challenge_data, tokens[0], tokens[1]);
-			}
-			/* Don't free each of the tokens, only the array. */
-			g_free(tokens);
+				/* Don't free each of the tokens, only the array. */
+				g_free(tokens);
+			} else
+				g_strfreev(tokens);
 		}
 
 		g_strfreev(elems);
@@ -735,7 +736,7 @@ msn_notification_send_fqy(MsnSession *se
 	msn_cmdproc_send_trans(cmdproc, trans);
 
 	g_free(payload);
-	g_free(tokens);
+	g_strfreev(tokens);
 }
 
 static void


More information about the Commits mailing list