changeset 6040:80e3641ee9eb

[gaim-migrate @ 6490] Various minor memleak fixes, and a rephrasing of an oscar error message. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 06 Jul 2003 06:57:42 +0000
parents 0c4d0c93c8c5
children ac0dd4dd9465
files src/account.c src/event.c src/gaimrc.c src/gtkprefs.c src/prefs.c src/protocols/oscar/oscar.c src/proxy.c
diffstat 7 files changed, 30 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/account.c	Sun Jul 06 05:07:11 2003 +0000
+++ b/src/account.c	Sun Jul 06 06:57:42 2003 +0000
@@ -991,10 +991,10 @@
 	if (!g_file_get_contents(filename, &contents, &length, &error)) {
 		gaim_debug(GAIM_DEBUG_ERROR, "accounts",
 				   "Error reading accounts: %s\n", error->message);
-		
 		g_error_free(error);
+		g_free(filename);
+		accounts_loaded = TRUE;
 
-		accounts_loaded = TRUE;
 		return FALSE;
 	}
 
@@ -1006,7 +1006,7 @@
 	if (!g_markup_parse_context_parse(context, contents, length, NULL)) {
 		g_markup_parse_context_free(context);
 		g_free(contents);
-
+		g_free(filename);
 		accounts_loaded = TRUE;
 
 		return FALSE;
@@ -1015,9 +1015,9 @@
 	if (!g_markup_parse_context_end_parse(context, NULL)) {
 		gaim_debug(GAIM_DEBUG_ERROR, "accounts", "Error parsing %s\n",
 				   filename);
-
 		g_markup_parse_context_free(context);
 		g_free(contents);
+		g_free(filename);
 		accounts_loaded = TRUE;
 
 		return FALSE;
@@ -1025,9 +1025,7 @@
 
 	g_markup_parse_context_free(context);
 	g_free(contents);
-
 	g_free(filename);
-
 	accounts_loaded = TRUE;
 
 	return TRUE;
--- a/src/event.c	Sun Jul 06 05:07:11 2003 +0000
+++ b/src/event.c	Sun Jul 06 06:57:42 2003 +0000
@@ -87,7 +87,6 @@
 
 	for (c = callbacks; c != NULL; c = next_c) {
 		next_c = c->next;
-
 		g = (GaimSignalCallback *)c->data;
 
 		if (handle == g->handle && func == g->function) {
@@ -114,7 +113,8 @@
 		g = (GaimSignalCallback *)c->data;
 
 		if (g->handle == handle) {
-			callbacks = g_list_remove(callbacks, (gpointer)g);
+			callbacks = g_list_remove(callbacks, c->data);
+			g_free(g);
 
 			gaim_debug(GAIM_DEBUG_INFO, "signals",
 					   "Removing callback. %d remain.\n",
--- a/src/gaimrc.c	Sun Jul 06 05:07:11 2003 +0000
+++ b/src/gaimrc.c	Sun Jul 06 06:57:42 2003 +0000
@@ -1243,6 +1243,7 @@
 			pref_name = g_strdup_printf("/gaim/gtk/sound/file/%s",
 					gaim_gtk_sound_get_event_option(i));
 			gaim_prefs_set_string(pref_name, p->value[0]);
+			g_free(pref_name);
 		}
 	}
 }
--- a/src/gtkprefs.c	Sun Jul 06 05:07:11 2003 +0000
+++ b/src/gtkprefs.c	Sun Jul 06 06:57:42 2003 +0000
@@ -1627,6 +1627,7 @@
 	GtkTreePath *path = gtk_tree_path_new_from_string(pth);
 	GaimPlugin *plug;
 	gchar buf[1024];
+	gchar *name = NULL, *description = NULL;
 	
 	GdkCursor *wait = gdk_cursor_new (GDK_WATCH);
 	gdk_window_set_cursor(prefs->window, wait);
@@ -1695,23 +1696,23 @@
 
 	gdk_window_set_cursor(prefs->window, NULL);
 
+	name = g_markup_escape_text(_(plug->info->name), -1);
+	description = g_markup_escape_text(_(plug->info->description), -1);
 	if (plug->error != NULL) {
+		gchar *error = g_markup_escape_text(plug->error, -1);
 		g_snprintf(buf, sizeof(buf),
 				   "<span size=\"larger\">%s %s</span>\n\n"
 				   "<span weight=\"bold\" color=\"red\">%s</span>\n\n"
 				   "%s",
-				   g_markup_escape_text(_(plug->info->name), -1),
-				   plug->info->version,
-				   g_markup_escape_text(plug->error, -1),
-				   g_markup_escape_text(_(plug->info->description), -1));
-	}
-	else {
+				   name, plug->info->version, error, description);
+		g_free(error);
+	} else {
 		g_snprintf(buf, sizeof(buf),
 				   "<span size=\"larger\">%s %s</span>\n\n%s",
-				   g_markup_escape_text(_(plug->info->name), -1),
-				   plug->info->version,
-				   g_markup_escape_text(_(plug->info->description), -1));
+				   name, plug->info->version, description);
 	}
+	g_free(name);
+	g_free(description);
 
 	gtk_label_set_markup(GTK_LABEL(plugin_description), buf);
 	gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0,
--- a/src/prefs.c	Sun Jul 06 05:07:11 2003 +0000
+++ b/src/prefs.c	Sun Jul 06 06:57:42 2003 +0000
@@ -830,7 +830,9 @@
 		gaim_debug(GAIM_DEBUG_ERROR, "prefs", "Error reading prefs: %s\n",
 				error->message);
 		g_error_free(error);
+		g_free(filename);
 		prefs_is_loaded = TRUE;
+
 		return FALSE;
 	}
 
@@ -839,7 +841,9 @@
 	if(!g_markup_parse_context_parse(context, contents, length, NULL)) {
 		g_markup_parse_context_free(context);
 		g_free(contents);
+		g_free(filename);
 		prefs_is_loaded = TRUE;
+
 		return FALSE;
 	}
 
@@ -847,14 +851,15 @@
 		gaim_debug(GAIM_DEBUG_ERROR, "prefs", "Error parsing %s\n", filename);
 		g_markup_parse_context_free(context);
 		g_free(contents);
+		g_free(filename);
 		prefs_is_loaded = TRUE;
+
 		return FALSE;
 	}
 
+	gaim_debug(GAIM_DEBUG_INFO, "prefs", "Finished reading %s\n", filename);
 	g_markup_parse_context_free(context);
 	g_free(contents);
-
-	gaim_debug(GAIM_DEBUG_INFO, "prefs", "Finished reading %s\n", filename);
 	g_free(filename);
 	prefs_is_loaded = TRUE;
 
--- a/src/protocols/oscar/oscar.c	Sun Jul 06 05:07:11 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Sun Jul 06 06:57:42 2003 +0000
@@ -3637,9 +3637,9 @@
 		aim_conn_setlatency(fr->conn, windowsize/4);
 	} else if (code == AIM_RATE_CODE_LIMIT) {
 		gaim_notify_error(sess->aux_data, NULL, _("Rate limiting error."),
-						  _("The last message was not sent because you "
-							"are over the rate limit.  Please wait 10 "
-							"seconds and try again."));
+						  _("The last action you attempted could not be "
+							"performed because you are over the rate limit. "
+							"Please wait 10 seconds and try again."));
 		aim_conn_setlatency(fr->conn, windowsize/2);
 	} else if (code == AIM_RATE_CODE_CLEARLIMIT) {
 		aim_conn_setlatency(fr->conn, 0);
--- a/src/proxy.c	Sun Jul 06 05:07:11 2003 +0000
+++ b/src/proxy.c	Sun Jul 06 06:57:42 2003 +0000
@@ -1531,12 +1531,14 @@
 {
 	const char *connecthost = host;
 	int connectport = port;
-	struct PHB *phb = g_new0(struct PHB, 1);
+	struct PHB *phb;
 
 	g_return_val_if_fail(host != NULL, -1);
 	g_return_val_if_fail(port != 0 && port != -1, -1);
 	g_return_val_if_fail(func != NULL, -1);
 
+	phb = g_new0(struct PHB, 1);
+
 	if (account == NULL || gaim_account_get_proxy_info(account) == NULL)
 		phb->gpi = gaim_global_proxy_get_info();
 	else