changeset 28717:911560d0c36f

merge of '0818f22621a06fa5a61bba3d4a10de1e42813cfa' and '4b9ca13f2987492c10363d58816d0a2e5bdee54c'
author Paul Aurich <paul@darkrain42.org>
date Fri, 09 Oct 2009 01:39:41 +0000
parents 203839bc0f7c (diff) 1e5b69e67677 (current diff)
children cb4853d04b92 3061a0c72b26
files
diffstat 11 files changed, 42 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gntbox.c	Fri Oct 09 01:16:11 2009 +0000
+++ b/finch/libgnt/gntbox.c	Fri Oct 09 01:39:41 2009 +0000
@@ -687,8 +687,8 @@
 		get_title_thingies(b, prev, &pos, &right);
 		mvwhline(w->window, 0, pos - 1, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL),
 				right - pos + 2);
-		g_free(prev);
 	}
+	g_free(prev);
 }
 
 void gnt_box_set_pad(GntBox *box, int pad)
--- a/finch/libgnt/gnttextview.c	Fri Oct 09 01:16:11 2009 +0000
+++ b/finch/libgnt/gnttextview.c	Fri Oct 09 01:39:41 2009 +0000
@@ -767,6 +767,7 @@
 							line->segments = g_list_delete_link(line->segments, segs);
 							if (line->segments == NULL) {
 								free_text_line(line, NULL);
+								line = NULL;
 								if (view->list == iter) {
 									if (inext)
 										view->list = inext;
@@ -780,7 +781,8 @@
 							seg->start = tag->start;
 							seg->end = tag->end - change;
 						}
-						line->length -= change;
+						if (line)
+							line->length -= change;
 						/* XXX: Make things work if the tagged text spans over several lines. */
 					} else {
 						/* XXX: handle the rest of the conditions */
--- a/finch/plugins/gnttinyurl.c	Fri Oct 09 01:16:11 2009 +0000
+++ b/finch/plugins/gnttinyurl.c	Fri Oct 09 01:39:41 2009 +0000
@@ -148,7 +148,9 @@
 					url_buf = g_strndup(c, t - c);
 					if (!g_list_find_custom(ret, url_buf, (GCompareFunc)strcmp)) {
 						purple_debug_info("TinyURL", "Added URL %s\n", url_buf);
-						ret = g_list_append(ret, g_strdup(url_buf));
+						ret = g_list_append(ret, url_buf);
+					} else {
+						g_free(url_buf);
 					}
 					c = t;
 					break;
@@ -179,6 +181,8 @@
 						if (!g_list_find_custom(ret, url_buf, (GCompareFunc)strcmp)) {
 							purple_debug_info("TinyURL", "Added URL %s\n", url_buf);
 							ret = g_list_append(ret, url_buf);
+						} else {
+							g_free(url_buf);
 						}
 						c = t;
 						break;
@@ -231,7 +235,7 @@
 				PurpleConversation *conv, PurpleMessageFlags flags)
 {
 	GString *t;
-	GList *iter, *urls;
+	GList *iter, *urls, *next;
 	int c = 0;
 
 	if ((flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_INVISIBLE)))
@@ -247,7 +251,8 @@
 
 	t = g_string_new(*message);
 	g_free(*message);
-	for (iter = urls; iter; iter = iter->next) {
+	for (iter = urls; iter; iter = next) {
+		next = iter->next;
 		if (g_utf8_strlen((char *)iter->data, -1) >= purple_prefs_get_int(PREF_LENGTH)) {
 			int pos, x = 0;
 			gchar *j, *s, *str, *orig;
@@ -265,15 +270,8 @@
 			g_free(str);
 			continue;
 		} else {
-			if (iter->prev) {
-				iter = iter->prev;
-				g_free(iter->next->data);
-				urls = g_list_delete_link(urls, iter->next);
-			} else {
-				g_free(iter->data);
-				g_list_free(urls);
-				urls = NULL;
-			}
+			g_free(iter->data);
+			urls = g_list_delete_link(urls, iter);
 		}
 	}
 	*message = t->str;
--- a/libpurple/account.c	Fri Oct 09 01:16:11 2009 +0000
+++ b/libpurple/account.c	Fri Oct 09 01:39:41 2009 +0000
@@ -1052,7 +1052,10 @@
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 	PURPLE_DBUS_UNREGISTER_POINTER(priv->current_error);
-	g_free(priv->current_error);
+	if (priv->current_error) {
+		g_free(priv->current_error->description);
+		g_free(priv->current_error);
+	}
 	g_free(priv);
 
 	PURPLE_DBUS_UNREGISTER_POINTER(account);
--- a/libpurple/plugins/perl/perl.c	Fri Oct 09 01:16:11 2009 +0000
+++ b/libpurple/plugins/perl/perl.c	Fri Oct 09 01:39:41 2009 +0000
@@ -621,6 +621,9 @@
 			g_free(gps);
 			plugin->info->extra_info = NULL;
 		}
+
+		g_free(plugin->info);
+		plugin->info = NULL;
 	}
 }
 
--- a/libpurple/protocols/msn/contact.c	Fri Oct 09 01:16:11 2009 +0000
+++ b/libpurple/protocols/msn/contact.c	Fri Oct 09 01:39:41 2009 +0000
@@ -206,6 +206,7 @@
 		                   "Operation {%s} failed. No response received from server.\n",
 		                   msn_contact_operation_str(state->action));
 		msn_session_set_error(state->session, MSN_ERROR_BAD_BLIST, NULL);
+		msn_callback_state_free(state);
 		return;
 	}
 
--- a/libpurple/protocols/msn/nexus.c	Fri Oct 09 01:16:11 2009 +0000
+++ b/libpurple/protocols/msn/nexus.c	Fri Oct 09 01:39:41 2009 +0000
@@ -338,8 +338,10 @@
 			xmlnode *cipher = xmlnode_get_child(node, "RequestedSecurityToken/EncryptedData/CipherData/CipherValue");
 			xmlnode *secret = xmlnode_get_child(node, "RequestedProofToken/BinarySecret");
 
+			g_free(nexus->cipher);
 			nexus->cipher = xmlnode_get_data(cipher);
 			data = xmlnode_get_data(secret);
+			g_free(nexus->secret);
 			nexus->secret = (char *)purple_base64_decode(data, NULL);
 			g_free(data);
 
--- a/libpurple/protocols/msn/notification.c	Fri Oct 09 01:16:11 2009 +0000
+++ b/libpurple/protocols/msn/notification.c	Fri Oct 09 01:39:41 2009 +0000
@@ -582,7 +582,7 @@
 
 	trans = msn_transaction_new(cmdproc, "FQY", "%d", payload_len);
 	msn_transaction_set_payload(trans, payload, payload_len);
-	msn_transaction_set_data(trans, data);
+	msn_transaction_set_data(trans, data);	/* XXX: 'data' leaks */
 	msn_cmdproc_send_trans(cmdproc, trans);
 }
 
@@ -621,7 +621,7 @@
 				user->list_op & MSN_LIST_OP_MASK, network);
 		payload = xmlnode_to_str(adl_node, &payload_len);
 		msn_notification_post_adl(session->notification->cmdproc, payload, payload_len);
-
+		g_free(payload);
 	} else {
 		purple_debug_error("msn",
 		                   "Got FQY update for unknown user %s on network %d.\n",
--- a/libpurple/protocols/msn/oim.c	Fri Oct 09 01:16:11 2009 +0000
+++ b/libpurple/protocols/msn/oim.c	Fri Oct 09 01:39:41 2009 +0000
@@ -481,6 +481,7 @@
 
 	g_free(msg_body);
 	g_free(soap_body);
+	msn_oim_free_send_req(oim_request);
 }
 
 /****************************************
--- a/libpurple/protocols/msn/servconn.c	Fri Oct 09 01:16:11 2009 +0000
+++ b/libpurple/protocols/msn/servconn.c	Fri Oct 09 01:39:41 2009 +0000
@@ -86,7 +86,7 @@
 	if (servconn->tx_handler > 0)
 		purple_input_remove(servconn->tx_handler);
 	if (servconn->timeout_handle > 0)
-		purple_input_remove(servconn->timeout_handle);
+		purple_timeout_remove(servconn->timeout_handle);
 
 	msn_cmdproc_destroy(servconn->cmdproc);
 	g_free(servconn);
@@ -280,7 +280,7 @@
 
 	if (servconn->timeout_handle > 0)
 	{
-		purple_input_remove(servconn->timeout_handle);
+		purple_timeout_remove(servconn->timeout_handle);
 		servconn->timeout_handle = 0;
 	}
 
@@ -300,7 +300,7 @@
 servconn_idle_timeout_cb(MsnServConn *servconn)
 {
 	msn_servconn_disconnect(servconn);
-	servconn->timeout_handle = 0;
+	servconn->timeout_handle = 0;	/* XXX: servconn may not be valid anymore */
 	return FALSE;
 }
 
@@ -308,7 +308,7 @@
 servconn_timeout_renew(MsnServConn *servconn)
 {
 	if (servconn->timeout_handle) {
-		purple_input_remove(servconn->timeout_handle);
+		purple_timeout_remove(servconn->timeout_handle);
 		servconn->timeout_handle = 0;
 	}
 
@@ -440,11 +440,12 @@
 	memcpy(servconn->rx_buf + servconn->rx_len, buf, len + 1);
 	servconn->rx_len += len;
 
-	msn_servconn_process_data(servconn);
-	servconn_timeout_renew(servconn);
+	servconn = msn_servconn_process_data(servconn);
+	if (servconn)
+		servconn_timeout_renew(servconn);
 }
 
-void msn_servconn_process_data(MsnServConn *servconn)
+MsnServConn *msn_servconn_process_data(MsnServConn *servconn)
 {
 	char *cur, *end, *old_rx_buf;
 	int cur_len;
@@ -503,10 +504,13 @@
 
 	servconn->processing = FALSE;
 
-	if (servconn->wasted)
+	if (servconn->wasted) {
 		msn_servconn_destroy(servconn);
+		servconn = NULL;
+	}
 
 	g_free(old_rx_buf);
+	return servconn;
 }
 
 #if 0
--- a/libpurple/protocols/msn/servconn.h	Fri Oct 09 01:16:11 2009 +0000
+++ b/libpurple/protocols/msn/servconn.h	Fri Oct 09 01:39:41 2009 +0000
@@ -178,8 +178,10 @@
  * data from the socket.
  *
  * @param servconn The servconn.
+ *
+ * @return @c NULL if servconn was destroyed, 'servconn' otherwise.
  */
-void msn_servconn_process_data(MsnServConn *servconn);
+MsnServConn *msn_servconn_process_data(MsnServConn *servconn);
 
 /**
  * Set a idle timeout fot this servconn