changeset 20990:bc731b26335c

Leak fixes.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 19 Oct 2007 01:28:55 +0000
parents 2097b1664fa3
children c8f99cb61dc9
files libpurple/protocols/msn/msn.c libpurple/protocols/msn/msnutils.c libpurple/protocols/msn/slp.c
diffstat 3 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c	Thu Oct 18 23:51:10 2007 +0000
+++ b/libpurple/protocols/msn/msn.c	Fri Oct 19 01:28:55 2007 +0000
@@ -964,6 +964,7 @@
 		friendname = msn_encode_mime(account->username);
 		msn_oim_prep_send_msg_info(oim, purple_account_get_username(account),
 								   friendname, who,	message);
+		g_free(friendname);
 		msn_oim_send_msg(oim);
 	}
 
--- a/libpurple/protocols/msn/msnutils.c	Thu Oct 18 23:51:10 2007 +0000
+++ b/libpurple/protocols/msn/msnutils.c	Fri Oct 19 01:28:55 2007 +0000
@@ -166,10 +166,15 @@
 char *
 msn_encode_mime(const char *str)
 {
-	char *base64;
+	gchar *base64, *retval;
+
+	g_return_val_if_fail(str != NULL, NULL);
 	
 	base64 = purple_base64_encode((guchar *)str, strlen(str));
-	return g_strdup_printf("=?utf-8?B?%s?=", base64);
+	retval = g_strdup_printf("=?utf-8?B?%s?=", base64);
+	g_free(base64);
+
+	return retval;
 }
 
 /*
--- a/libpurple/protocols/msn/slp.c	Thu Oct 18 23:51:10 2007 +0000
+++ b/libpurple/protocols/msn/slp.c	Fri Oct 19 01:28:55 2007 +0000
@@ -505,6 +505,9 @@
 		int port;
 
 		nonce = get_token(content, "Nonce: {", "}\r\n");
+		if (ip_addrs == NULL)
+			return;
+
 		ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
 
 		temp = get_token(content, "IPv4Internal-Port: ", "\r\n");
@@ -514,9 +517,6 @@
 			port = -1;
 		g_free(temp);
 
-		if (ip_addrs == NULL)
-			return;
-
 		if (port > 0)
 			got_transresp(slpcall, nonce, ip_addrs, port);
 
@@ -598,6 +598,9 @@
 		int port;
 
 		nonce = get_token(content, "Nonce: {", "}\r\n");
+		if (ip_addrs == NULL)
+			return;
+
 		ip_addrs = get_token(content, "IPv4Internal-Addrs: ", "\r\n");
 
 		temp = get_token(content, "IPv4Internal-Port: ", "\r\n");
@@ -607,9 +610,6 @@
 			port = -1;
 		g_free(temp);
 
-		if (ip_addrs == NULL)
-			return;
-
 		if (port > 0)
 			got_transresp(slpcall, nonce, ip_addrs, port);