[gnome-mud] Memleak fixes



kmaraas pointed me at a few necessary fixes on IRC.

Can anyone review this probably fucked up patch and tell me if it's ok?
If there's more to plug, please do :)

Les: where are you!

Jordi
-- 
Jordi Mallach Pérez  --  Debian developer     http://www.debian.org/
jordi sindominio net     jordi debian org     http://www.sindominio.net/
GnuPG public key information available at http://oskuro.net/
? debian
? gar.patch
? leakpatch
? pluginmake.patch
? plugins/automapper/Makefile.am
? plugins/outputwindows/Makefile.am
? plugins/statusbars/Makefile.am
? po/stamp-it
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-mud/ChangeLog,v
retrieving revision 1.382
diff -u -p -r1.382 ChangeLog
--- ChangeLog	8 Jun 2006 18:30:25 -0000	1.382
+++ ChangeLog	23 Aug 2006 22:51:08 -0000
@@ -1,3 +1,14 @@
+2006-08-24  Jordi Mallach  <jordi sindominio net>
+
+	* src/mud-preferences-window.c, src/mud-window-mudedit.c,
+	src/mud-window-mudlist.c: don't wrap gconf_client_get_string()
+	calls around g_strdup(), as it leaks the string and
+	gconf_client_get_string() already does the right thing.
+	* src/mud-parse-alias.c, src/mud-parse-alias.c,
+	mud-preferences-window.c, mud-window-mudlist.c: Plug memleaks.
+
+	Thanks to Kjartan Maraas for the pointers.
+
 2006-06-08  Jordi Mallach  <jordi sindominio net>
 
 	* plugins/automapper/map.c, ui/prefs.glade,
Index: src/mud-parse-alias.c
===================================================================
RCS file: /cvs/gnome/gnome-mud/src/mud-parse-alias.c,v
retrieving revision 1.1
diff -u -p -r1.1 mud-parse-alias.c
--- src/mud-parse-alias.c	15 May 2006 12:55:32 -0000	1.1
+++ src/mud-parse-alias.c	23 Aug 2006 22:51:09 -0000
@@ -139,6 +139,7 @@ mud_parse_alias_do(gchar *data, MudConne
 		}
 	}	
 	
+	g_free(aliases);
 	return send_line;
 }
 
Index: src/mud-parse-trigger.c
===================================================================
RCS file: /cvs/gnome/gnome-mud/src/mud-parse-trigger.c,v
retrieving revision 1.1
diff -u -p -r1.1 mud-parse-trigger.c
--- src/mud-parse-trigger.c	15 May 2006 12:55:32 -0000	1.1
+++ src/mud-parse-trigger.c	23 Aug 2006 22:51:09 -0000
@@ -158,6 +158,7 @@ mud_parse_trigger_do(gchar *data, MudCon
 		}
 	}	
 
+	g_free(triggers);
 	return doGag;
 }
 
Index: src/mud-preferences-window.c
===================================================================
RCS file: /cvs/gnome/gnome-mud/src/mud-preferences-window.c,v
retrieving revision 1.11
diff -u -p -r1.11 mud-preferences-window.c
--- src/mud-preferences-window.c	15 May 2006 12:55:32 -0000	1.11
+++ src/mud-preferences-window.c	23 Aug 2006 22:51:11 -0000
@@ -607,7 +607,7 @@ mud_preferences_window_trigger_select_cb
 		gtk_entry_set_text(GTK_ENTRY(prefs->priv->trigger_name_entry),gconf_client_get_string(client, keyname, &error));
 		
 		g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/regex", profile_name, prefs->priv->trigger_info.text);
-		regex = g_strdup(gconf_client_get_string(client, keyname, &error));
+		regex = gconf_client_get_string(client, keyname, &error);
 
 		if(regex) 
 		{
@@ -616,7 +616,7 @@ mud_preferences_window_trigger_select_cb
 		}
 		
 		g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/triggers/%s/actions", profile_name, prefs->priv->trigger_info.text);
-		actions = g_strdup(gconf_client_get_string(client, keyname, &error));
+		actions = gconf_client_get_string(client, keyname, &error);
 
 		if(actions) 
 		{
@@ -663,7 +663,7 @@ mud_preferences_window_alias_select_cb(G
 		gtk_entry_set_text(GTK_ENTRY(prefs->priv->alias_entry),gconf_client_get_string(client, keyname, &error));
 		
 		g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/%s/actions", profile_name, prefs->priv->alias_info.text);
-		actions = g_strdup(gconf_client_get_string(client, keyname, &error));
+		actions = gconf_client_get_string(client, keyname, &error);
 
 		if(actions) 
 		{
@@ -672,7 +672,7 @@ mud_preferences_window_alias_select_cb(G
 		}
 
 		g_snprintf(keyname, 2048, "/apps/gnome-mud/profiles/%s/aliases/%s/regex", profile_name, prefs->priv->alias_info.text);
-		regex = g_strdup(gconf_client_get_string(client, keyname, &error));
+		regex = gconf_client_get_string(client, keyname, &error);
 
 		if(regex) 
 		{
@@ -1148,6 +1148,8 @@ mud_preferences_window_alias_del_cb(GtkW
 	gconf_client_set_list(client, keyname, GCONF_VALUE_STRING, aliases, &error);	
 	
 	mud_preferences_window_populate_alias_treeview(window);
+
+	g_free(aliases);
 }
 
 static void
Index: src/mud-window-mudedit.c
===================================================================
RCS file: /cvs/gnome/gnome-mud/src/mud-window-mudedit.c,v
retrieving revision 1.8
diff -u -p -r1.8 mud-window-mudedit.c
--- src/mud-window-mudedit.c	15 May 2006 12:55:32 -0000	1.8
+++ src/mud-window-mudedit.c	23 Aug 2006 22:51:11 -0000
@@ -222,7 +222,7 @@ mud_edit_window_query_gconf(MudEditWindo
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mudedit->priv->btnShowToggle),gconf_client_get_int(client, keyname, &error));
 
 	g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/desc", mudedit->priv->mud);
-	desc = g_strdup(gconf_client_get_string(client, keyname, &error));
+	desc = gconf_client_get_string(client, keyname, &error);
 
 	if(desc) 
 	{
@@ -332,7 +332,7 @@ props_window_dialog(gchar *charname, Mud
 		gtk_entry_set_text(GTK_ENTRY(name), charname);
 		
 		g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/chars/%s/connect", mudname, charname);
-		connect = g_strdup(gconf_client_get_string(client, keyname, &error));
+		connect = gconf_client_get_string(client, keyname, &error);
 		if(connect)
 		{
 			gtk_text_buffer_set_text(buffer, connect, strlen(connect));
@@ -507,7 +507,7 @@ mud_edit_window_ok_cb(GtkWidget *widget,
 		g_free(mudedit->priv->mud);
 		mudedit->priv->mud = g_strdup(name);
 
-		// This seems to do nothing. WTF. -lh
+		/* FIXME This seems to do nothing. WTF. -lh */
 		gconf_client_remove_dir(client, keyname, &error);
 	}
 
Index: src/mud-window-mudlist.c
===================================================================
RCS file: /cvs/gnome/gnome-mud/src/mud-window-mudlist.c,v
retrieving revision 1.5
diff -u -p -r1.5 mud-window-mudlist.c
--- src/mud-window-mudlist.c	15 May 2006 12:55:32 -0000	1.5
+++ src/mud-window-mudlist.c	23 Aug 2006 22:51:11 -0000
@@ -211,6 +211,7 @@ mud_list_window_populate_treeview(MudLis
 		gtk_tree_store_set(store, &iter, NAME_COLUMN, gconf_client_get_string(client, keyname, &error), -1);
 		g_free(mname);
 	}	
+	g_free(muds);
 }
 
 // Mudlist Callbacks
@@ -298,7 +299,7 @@ mud_list_window_tree_select_cb(GtkTreeSe
 
 		g_snprintf(keyname, 2048, "/apps/gnome-mud/muds/%s/desc", remove_whitespace(mudlist->priv->CurrSelRowText));
 		
-		desc = g_strdup(gconf_client_get_string(client, keyname, &error));
+		desc = gconf_client_get_string(client, keyname, &error);
 		if(desc)
 		{
 			gtk_text_buffer_set_text(buffer, desc, strlen(desc));

Attachment: signature.asc
Description: Digital signature



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