changeset 4800:4af15fbcb00a

[gaim-migrate @ 5120] Paco-Paco is cool, he fixed my mess, and then fixed other messes I didn't even know we had. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 16 Mar 2003 17:49:11 +0000
parents 7fd8a82a7c36
children ef6d17c83328
files src/core.c src/main.c src/prefs.c src/protocols/oscar/oscar.c
diffstat 4 files changed, 24 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/core.c	Sun Mar 16 07:51:11 2003 +0000
+++ b/src/core.c	Sun Mar 16 17:49:11 2003 +0000
@@ -100,7 +100,7 @@
 	gint sent;
 	/* we'll let the write silently fail because the read will pick it up as dead */
 	g_io_channel_write_chars(ui->channel, data, len, &sent, &error);
-	g_free(error);
+	g_error_free(error);
 	return sent;
 }
 
@@ -182,7 +182,7 @@
 	}
 
 	if(error)
-		g_free(error);
+		g_error_free(error);
 }
 
 static void plugin_handler(struct UI *ui, guchar subtype, guchar *data)
@@ -298,11 +298,11 @@
 	gint total = 0;
 	gint cur;
 
-	GError *error;
+	GError *error = NULL;
 
 	while (total < len) {
 		if (g_io_channel_read_chars(source, buf + total, len - total, &cur, &error) != G_IO_STATUS_NORMAL) {
-			g_free(error);
+			g_error_free(error);
 			return -1;
 		}
 		if (cur == 0)
@@ -352,7 +352,7 @@
 		uis = g_slist_remove(uis, ui);
 		g_io_channel_shutdown(ui->channel, TRUE, &error);
 		if(error)
-			g_free(error);
+			g_error_free(error);
 		g_source_remove(ui->inpa);
 		g_free(ui);
 		return FALSE;
@@ -363,7 +363,7 @@
 		uis = g_slist_remove(uis, ui);
 		g_io_channel_shutdown(ui->channel, TRUE, &error);
 		if(error)
-			g_free(error);
+			g_error_free(error);
 		g_source_remove(ui->inpa);
 		g_free(ui);
 		return FALSE;
@@ -374,7 +374,7 @@
 		uis = g_slist_remove(uis, ui);
 		g_io_channel_shutdown(ui->channel, TRUE, &error);
 		if(error)
-			g_free(error);
+			g_error_free(error);
 		g_source_remove(ui->inpa);
 		g_free(ui);
 		return FALSE;
@@ -387,7 +387,7 @@
 			uis = g_slist_remove(uis, ui);
 			g_io_channel_shutdown(ui->channel, TRUE, &error);
 			if(error)
-				g_free(error);
+				g_error_free(error);
 			g_source_remove(ui->inpa);
 			g_free(ui);
 			return FALSE;
--- a/src/main.c	Sun Mar 16 07:51:11 2003 +0000
+++ b/src/main.c	Sun Mar 16 17:49:11 2003 +0000
@@ -475,7 +475,7 @@
 	debug_printf("Core says: ");
 	g_io_channel_read_chars(source, &type, sizeof(type), &x, &error);
 	if(error)
-		g_free(error);
+		g_error_free(error);
 	if (x == 0) {
 		debug_printf("CORE IS GONE!\n");
 		g_io_channel_shutdown(source, TRUE, &error);
@@ -486,23 +486,23 @@
 	debug_printf("%d ", type);
 	g_io_channel_read_chars(source, &subtype, sizeof(subtype), &x, &error);
 	if(error)
-		g_free(error);
+		g_error_free(error);
 	if (x == 0) {
 		debug_printf("CORE IS GONE!\n");
 		g_io_channel_shutdown(source, TRUE, &error);
 		if(error)
-			g_free(error);
+			g_error_free(error);
 		return FALSE;
 	}
 	debug_printf("%d ", subtype);
 	g_io_channel_read_chars(source, (guchar *)&len, sizeof(len), &x, &error);
 	if(error)
-		g_free(error);
+		g_error_free(error);
 	if (x == 0) {
 		debug_printf("CORE IS GONE!\n");
 		g_io_channel_shutdown(source, TRUE, &error);
 		if(error)
-			g_free(error);
+			g_error_free(error);
 		return FALSE;
 	}
 	debug_printf("(%d bytes)\n", len);
@@ -510,13 +510,13 @@
 	data = g_malloc(len);
 	g_io_channel_read_chars(source, data, len, &x, &error);
 	if(error)
-		g_free(error);
+		g_error_free(error);
 	if (x != len) {
 		debug_printf("CORE IS GONE! (read %d/%d bytes)\n", x, len);
 		g_free(data);
 		g_io_channel_shutdown(source, TRUE, &error);
 		if(error)
-			g_free(error);
+			g_error_free(error);
 		return FALSE;
 	}
 
--- a/src/prefs.c	Sun Mar 16 07:51:11 2003 +0000
+++ b/src/prefs.c	Sun Mar 16 17:49:11 2003 +0000
@@ -2218,6 +2218,7 @@
 
 	if (!g_shell_parse_argv(program, NULL, &argv, &error)) {
 		debug_printf("Could not parse program '%s': ", error->message);
+		g_error_free(error);
 		return FALSE;
 	}
 
--- a/src/protocols/oscar/oscar.c	Sun Mar 16 07:51:11 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Sun Mar 16 17:49:11 2003 +0000
@@ -2035,6 +2035,7 @@
 		if (err) {
 			debug_printf("Unicode IM conversion: %s\n", err->message);
 			tmp = strdup(_("(There was an error receiving this message)"));
+			g_error_free(err);
 		}
 	} else {
 		/* This will get executed for both AIM_IMFLAGS_ISO_8859_1 and
@@ -2054,6 +2055,7 @@
 		if (err) {
 			debug_printf("ISO-8859-1 IM conversion: %s\n", err->message);
 			tmp = strdup(_("(There was an error receiving this message)"));
+			g_error_free(err);
 		}
 	}
 
@@ -2325,8 +2327,10 @@
 	for (i=0; msg1[i]; i++) {
 		strip_linefeed(msg1[i]);
 		msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err);
-		if (err)
+		if (err) {
 			debug_printf("Error converting a string from ISO-8859-1 to UTF-8 in oscar ICBM channel 4 parsing\n");
+			g_error_free(err);
+		}
 	}
 	msg2[i] = NULL;
 
@@ -3967,6 +3971,7 @@
 				debug_printf("This really shouldn't happen!\n");
 				/* We really shouldn't try to send the
 				 * IM now, but I'm not sure what to do */
+				g_error_free(err);
 			}
 		} else if (args.flags & AIM_IMFLAGS_ISO_8859_1) {
 			debug_printf("Sending ISO-8859-1 IM\n");
@@ -3978,9 +3983,11 @@
 				debug_printf("Someone tell Ethan his 8859-1 detection is wrong\n");
 				args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE;
 				len = strlen(message);
+				g_error_free(err);
 				args.msg = g_convert(message, len, "UCS-2BE", "UTF8", NULL, &len, &err);
 				if (err) {
 					debug_printf("Error in unicode fallback: %s\n", err->message);
+					g_error_free(err);
 				}
 			}
 		} else {