diff libpurple/protocols/msn/soap2.c @ 22808:f62a4a7fe365

Fix a number of leaks. As far as I can tell, MSNP14 now logs in without leaking.
author Daniel Atallah <daniel.atallah@gmail.com>
date Sat, 03 May 2008 23:51:43 +0000
parents fc060adb7178
children 84807b5e60fa
line wrap: on
line diff
--- a/libpurple/protocols/msn/soap2.c	Sat May 03 21:03:13 2008 +0000
+++ b/libpurple/protocols/msn/soap2.c	Sat May 03 23:51:43 2008 +0000
@@ -261,7 +261,7 @@
 static void
 msn_soap_read_cb(gpointer data, gint fd, PurpleInputCondition cond)
 {
-    MsnSoapConnection *conn = data;
+	MsnSoapConnection *conn = data;
 	int count = 0, cnt;
 	char buf[8192];
 	char *linebreak;
@@ -382,7 +382,7 @@
 	}
 
 	if (!handled && conn->headers_done) {
-		if (conn->buf->len - conn->handled_len >= 
+		if (conn->buf->len - conn->handled_len >=
 			conn->body_len) {
 			xmlnode *node = xmlnode_from_str(cursor, conn->body_len);
 
@@ -394,8 +394,11 @@
 				conn->message = NULL;
 				message->xml = node;
 
-				if (!msn_soap_handle_body(conn, message))
+				if (!msn_soap_handle_body(conn, message)) {
+					msn_soap_message_destroy(message);
 					return;
+				}
+				msn_soap_message_destroy(message);
 			}
 
 			msn_soap_connection_handle_next(conn);
@@ -508,7 +511,7 @@
 
 			g_free(authstr);
 			g_free(body);
-		}		
+		}
 	}
 
 	return FALSE;
@@ -643,12 +646,12 @@
 }
 
 void
-msn_soap_message_add_header(MsnSoapMessage *req,
+msn_soap_message_add_header(MsnSoapMessage *message,
 		const char *name, const char *value)
 {
 	char *header = g_strdup_printf("%s: %s\r\n", name, value);
 
-	req->headers = g_slist_prepend(req->headers, header);
+	message->headers = g_slist_prepend(message->headers, header);
 }
 
 static void