changeset 4817:b4ca2cc6bed9

[gaim-migrate @ 5141] <LSchiere> Paco-Paco: commit message? <Paco-Paco> I forget <Paco-Paco> let me look <Paco-Paco> initialize GError pointers properly committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 18 Mar 2003 03:03:58 +0000
parents 94e75b03c598
children 1c371e4244d6
files src/core.c
diffstat 1 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/core.c	Tue Mar 18 02:05:48 2003 +0000
+++ b/src/core.c	Tue Mar 18 03:03:58 2003 +0000
@@ -96,11 +96,12 @@
 
 gint UI_write(struct UI *ui, guchar *data, gint len)
 {
-	GError *error;
+	GError *error = NULL;
 	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_error_free(error);
+	if (error)
+		g_error_free(error);
 	return sent;
 }
 
@@ -302,7 +303,8 @@
 
 	while (total < len) {
 		if (g_io_channel_read_chars(source, buf + total, len - total, &cur, &error) != G_IO_STATUS_NORMAL) {
-			g_error_free(error);
+			if (error)
+				g_error_free(error);
 			return -1;
 		}
 		if (cur == 0)
@@ -342,7 +344,7 @@
 	guchar subtype;
 	guint32 len;
 
-	GError *error;
+	GError *error = NULL;
 
 	guchar *in;
 
@@ -351,8 +353,10 @@
 		debug_printf("UI has abandoned us!\n");
 		uis = g_slist_remove(uis, ui);
 		g_io_channel_shutdown(ui->channel, TRUE, &error);
-		if(error)
+		if(error) {
 			g_error_free(error);
+			error = NULL;
+		}
 		g_source_remove(ui->inpa);
 		g_free(ui);
 		return FALSE;
@@ -362,8 +366,10 @@
 		debug_printf("UI has abandoned us!\n");
 		uis = g_slist_remove(uis, ui);
 		g_io_channel_shutdown(ui->channel, TRUE, &error);
-		if(error)
+		if(error) {
 			g_error_free(error);
+			error = NULL;
+		}
 		g_source_remove(ui->inpa);
 		g_free(ui);
 		return FALSE;
@@ -373,8 +379,10 @@
 		debug_printf("UI has abandoned us!\n");
 		uis = g_slist_remove(uis, ui);
 		g_io_channel_shutdown(ui->channel, TRUE, &error);
-		if(error)
+		if(error) {
 			g_error_free(error);
+			error = NULL;
+		}
 		g_source_remove(ui->inpa);
 		g_free(ui);
 		return FALSE;
@@ -386,8 +394,10 @@
 			debug_printf("UI has abandoned us!\n");
 			uis = g_slist_remove(uis, ui);
 			g_io_channel_shutdown(ui->channel, TRUE, &error);
-			if(error)
+			if(error) {
 				g_error_free(error);
+				error = NULL;
+			}
 			g_source_remove(ui->inpa);
 			g_free(ui);
 			return FALSE;