gnome-bluetooth r607 - in trunk: applet common



Author: hadess
Date: Mon Apr 13 16:36:55 2009
New Revision: 607
URL: http://svn.gnome.org/viewvc/gnome-bluetooth?rev=607&view=rev

Log:
Patch from Daniele Forsi <dforsi gmail com> to fix some memleaks in gtk_tree_model_get () usage (Closes: #578846)


Modified:
   trunk/applet/main.c
   trunk/common/bluetooth-chooser.c

Modified: trunk/applet/main.c
==============================================================================
--- trunk/applet/main.c	(original)
+++ trunk/applet/main.c	Mon Apr 13 16:36:55 2009
@@ -490,7 +490,7 @@
 	while (cont) {
 		GHashTable *table;
 		DBusGProxy *proxy;
-		const char *alias, *address;
+		char *alias, *address;
 		gboolean is_connected;
 		GtkAction *action, *status, *oper;
 
@@ -612,6 +612,8 @@
 		if (proxy != NULL)
 			g_object_unref (proxy);
 
+		g_free (alias);
+		g_free (address);
 		cont = gtk_tree_model_iter_next (devices_model, &iter);
 	}
 

Modified: trunk/common/bluetooth-chooser.c
==============================================================================
--- trunk/common/bluetooth-chooser.c	(original)
+++ trunk/common/bluetooth-chooser.c	Mon Apr 13 16:36:55 2009
@@ -139,8 +139,7 @@
 alias_to_label (GtkTreeViewColumn *column, GtkCellRenderer *cell,
 		GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
 {
-	const char *alias;
-	char *label, *escaped;
+	char *alias, *escaped, *label;
 	gboolean connected;
 
 	gtk_tree_model_get (model, iter,
@@ -150,15 +149,15 @@
 
 	if (connected == FALSE) {
 		g_object_set (cell, "text", alias, NULL);
-		return;
-	}
-
-	escaped = g_markup_escape_text (alias, -1);
-	label = g_strdup_printf ("<b>%s</b>", escaped);
-	g_free (escaped);
+	} else {
+		escaped = g_markup_escape_text (alias, -1);
+		label = g_strdup_printf ("<b>%s</b>", escaped);
+		g_free (escaped);
 
-	g_object_set (cell, "markup", label, NULL);
-	g_free (label);
+		g_object_set (cell, "markup", label, NULL);
+		g_free (label);
+	}
+	g_free (alias);
 }
 
 /**



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