gnome-mud r718 - in trunk: . src



Author: lharris
Date: Thu Feb 12 11:26:11 2009
New Revision: 718
URL: http://svn.gnome.org/viewvc/gnome-mud?rev=718&view=rev

Log:
Memleak fix, Warning removal.


Modified:
   trunk/ChangeLog
   trunk/src/modules.c
   trunk/src/mud-connection-view.c
   trunk/src/mud-connections.c
   trunk/src/mud-log.c
   trunk/src/mud-window.c

Modified: trunk/src/modules.c
==============================================================================
--- trunk/src/modules.c	(original)
+++ trunk/src/modules.c	Thu Feb 12 11:26:11 2009
@@ -471,7 +471,7 @@
 {
 	GtkWidget *dialog;
 
-	dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, data);
+	dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "%s", data);
 
 	gtk_dialog_run(GTK_DIALOG(dialog));
 	gtk_widget_destroy(dialog);

Modified: trunk/src/mud-connection-view.c
==============================================================================
--- trunk/src/mud-connection-view.c	(original)
+++ trunk/src/mud-connection-view.c	Thu Feb 12 11:26:11 2009
@@ -239,7 +239,7 @@
 	for ( pc = buf, out = out_buf; *pc && (out-out_buf) < (4608-len-4);)
 		if ( !strncasecmp(pc, s, len))
 		{
-			out += sprintf (out, repl);
+			out += sprintf (out, "%s", repl);
 			pc += len;
 			found = TRUE;
 		}

Modified: trunk/src/mud-connections.c
==============================================================================
--- trunk/src/mud-connections.c	(original)
+++ trunk/src/mud-connections.c	Thu Feb 12 11:26:11 2009
@@ -927,14 +927,8 @@
 	    return FALSE;
 	    break;	
 	case 1:
-	    if(mud_connections_property_save(conn))
-	    {
-		return FALSE;
-	    }
-	    else
-		return TRUE;
+	    return mud_connections_property_save(conn);
 	    break;
-
 	case 0:
 	    return TRUE;
 	    break;
@@ -1011,6 +1005,9 @@
 	if(logon)
 	    g_free(logon);
 
+	if(profile)
+	    g_free(profile);
+
 	return FALSE;
     }
        

Modified: trunk/src/mud-log.c
==============================================================================
--- trunk/src/mud-log.c	(original)
+++ trunk/src/mud-log.c	Thu Feb 12 11:26:11 2009
@@ -141,7 +141,7 @@
 		strftime(buf, 1024,
 				 _("\n*** Log starts *** %d/%m/%Y %H:%M:%S\n"),
 				 localtime(&t));
-		fprintf(log->priv->logfile, buf);
+		fprintf(log->priv->logfile, "%s", buf);
 	}
 
 	log->priv->active = TRUE;
@@ -159,7 +159,8 @@
 	stripData = strip_ansi((const gchar *)data);
 	stripSize = strlen(stripData);
 
-	fwrite(stripData, 1, stripSize, log->priv->logfile);
+	if(!fwrite(stripData, 1, stripSize, log->priv->logfile))
+		g_critical(_("Could not write data to log file!"));
 
 	g_free(stripData);
 }
@@ -178,7 +179,7 @@
 			_("\n *** Log stops *** %d/%m/%Y %H:%M:%S\n"),
 			localtime(&t));
 
-	fprintf(log->priv->logfile, buf);
+	fprintf(log->priv->logfile, "%s", buf);
 	fclose(log->priv->logfile);
 
 	log->priv->active = FALSE;

Modified: trunk/src/mud-window.c
==============================================================================
--- trunk/src/mud-window.c	(original)
+++ trunk/src/mud-window.c	Thu Feb 12 11:26:11 2009
@@ -562,7 +562,9 @@
 											NULL,
 											NULL);
 
-			fwrite(bufferText, 1, strlen(bufferText), file);
+			if(!fwrite(bufferText, 1, strlen(bufferText), file))
+				g_critical(_("Could not write buffer to disk!"));
+
 			fclose(file);
 		}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]