--- capplets/default-applications/gnome-da-capplet.orig	Wed Jan 10 22:09:29 2007
+++ capplets/default-applications/gnome-da-capplet.c	Thu Jan 11 00:12:40 2007
@@ -215,7 +215,7 @@ web_combo_changed_cb (GtkComboBox *combo
     gtk_widget_set_sensitive (capplet->web_browser_command_label, is_custom_active);
     gtk_widget_set_sensitive (capplet->web_browser_terminal_checkbutton, is_custom_active);
 }
-
+	
 static void
 mail_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
 {
@@ -688,7 +688,6 @@ fill_combo_box (GtkIconTheme *theme, Gtk
     GtkCellRenderer *renderer;
     GtkTreeIter iter;
     GdkPixbuf *pixbuf;
-    gchar *label;
 
     if (theme == NULL) {
 	theme = gtk_icon_theme_get_default ();
@@ -720,19 +719,17 @@ fill_combo_box (GtkIconTheme *theme, Gtk
 	item = (GnomeDAItem *) entry->data;
 
 	pixbuf = gtk_icon_theme_load_icon (theme, item->icon_name, 22, 0, NULL);
-	label = g_strdup (item->name);
 
 	gtk_list_store_append (GTK_LIST_STORE (model), &iter);
 	gtk_list_store_set (GTK_LIST_STORE (model), &iter,
 			    PIXBUF_COL, pixbuf,
-			    TEXT_COL, label,
+			    TEXT_COL, item->name,
 			    -1);
 
 	item->icon_path = gtk_tree_model_get_string_from_iter (model, &iter);
 
 	if (pixbuf)
 	    g_object_unref (pixbuf);
-	g_free (label);
     }
 
     gtk_list_store_append (GTK_LIST_STORE (model), &iter);
@@ -802,26 +799,50 @@ show_dialog (GnomeDACapplet *capplet)
 
     /* update ui to gconf content */
     value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_HTTP_EXEC, NULL);
-    web_browser_update_combo_box (capplet, gconf_value_get_string (value));
-    web_browser_update_radio_buttons (capplet, gconf_value_get_string (value));
+    if (value)
+    {
+	web_browser_update_combo_box (capplet, gconf_value_get_string (value));
+	web_browser_update_radio_buttons (capplet, gconf_value_get_string (value));
+	gconf_value_free (value);
+    }
 
     value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM, NULL);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->web_browser_terminal_checkbutton),
-				  gconf_value_get_bool (value));
+    if (value)
+    {
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->web_browser_terminal_checkbutton),
+				      gconf_value_get_bool (value));
+	gconf_value_free (value);
+    }
 
     value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MAILER_EXEC, NULL);
-    mail_reader_update_combo_box (capplet, gconf_value_get_string (value));
+    if (value)
+    {
+	mail_reader_update_combo_box (capplet, gconf_value_get_string (value));
+	gconf_value_free (value);
+    }
 
     value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MAILER_NEEDS_TERM, NULL);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->mail_reader_terminal_checkbutton),
-				  gconf_value_get_bool (value));
+    if (value)
+    {
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->mail_reader_terminal_checkbutton),
+				      gconf_value_get_bool (value));
+	gconf_value_free (value);
+    }
 
-    value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC, NULL);
-    terminal_update_combo_box (capplet, gconf_value_get_string (value));
+    if (value)
+    {
+	value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC, NULL);
+	terminal_update_combo_box (capplet, gconf_value_get_string (value));
+	gconf_value_free (value);
+    }
 
     value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG, NULL);
-    gtk_entry_set_text (GTK_ENTRY (capplet->terminal_exec_flag_entry),
-			gconf_value_get_string (value));
+    if (value)
+    {
+	gtk_entry_set_text (GTK_ENTRY (capplet->terminal_exec_flag_entry),
+			    gconf_value_get_string (value));
+	gconf_value_free (value);
+    }
 
     g_signal_connect (capplet->web_combo_box, "changed", G_CALLBACK (web_combo_changed_cb), capplet);
     g_signal_connect (capplet->mail_combo_box, "changed", G_CALLBACK (mail_combo_changed_cb), capplet);
@@ -853,21 +874,21 @@ show_dialog (GnomeDACapplet *capplet)
 int
 main (int argc, char **argv)
 {
+    GnomeProgram *program;
     GnomeDACapplet *capplet;
 
-    capplet = g_new0 (GnomeDACapplet, 1);
-
 #ifdef ENABLE_NLS
     bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
     bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
     textdomain (GETTEXT_PACKAGE);
 #endif
 
-    gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE, argc, argv,
-			GNOME_PARAM_NONE);
+    program = gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE,
+			argc, argv, GNOME_PARAM_NONE);
 
     glade_init ();
 
+    capplet = g_new0 (GnomeDACapplet, 1);
     capplet->gconf = gconf_client_get_default ();
 
     gconf_client_add_dir (capplet->gconf, "/desktop/gnome/applications/browser", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
@@ -891,7 +912,9 @@ main (int argc, char **argv)
     gtk_main ();
 
     g_object_unref (capplet->gconf);
-    g_object_unref (capplet->xml);
+    
+    gnome_da_xml_free (capplet);
+    g_object_unref (program);
 
     return 0;
 }
--- capplets/default-applications/gnome-da-xml.orig	Wed Jan 10 22:14:36 2007
+++ capplets/default-applications/gnome-da-xml.c	Thu Jan 11 00:13:58 2007
@@ -128,6 +128,7 @@ gnome_da_xml_load_xml (GnomeDACapplet *c
 {
     xmlDoc *xml_doc;
     xmlNode *root, *section, *element;
+    gchar *executable;
     GnomeDAWebItem *web_item;
     GnomeDAMailItem *mail_item;
     GnomeDATermItem *term_item;
@@ -143,11 +144,12 @@ gnome_da_xml_load_xml (GnomeDACapplet *c
 	if (!xmlStrncmp (section->name, "web-browsers", 12)) {
 	    for (element = section->children; element != NULL; element = element->next) {
 		if (!xmlStrncmp (element->name, "web-browser", 11)) {
-		    if (is_executable_valid (gnome_da_xml_get_string (element, "executable"))) {
+		    executable = gnome_da_xml_get_string (element, "executable");
+		    if (is_executable_valid (executable)) {
 			web_item = gnome_da_web_item_new ();
 
 			web_item->generic.name = gnome_da_xml_get_string (element, "name");
-			web_item->generic.executable = gnome_da_xml_get_string (element, "executable");
+			web_item->generic.executable = executable;
 			web_item->generic.command = gnome_da_xml_get_string (element, "command");
 			web_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
 
@@ -160,17 +162,20 @@ gnome_da_xml_load_xml (GnomeDACapplet *c
 
 			capplet->web_browsers = g_list_append (capplet->web_browsers, web_item);
 		    }
+		    else
+			g_free (executable);
 		}
 	    }
 	}
 	else if (!xmlStrncmp (section->name, "mail-readers", 12)) {
 	    for (element = section->children; element != NULL; element = element->next) {
 		if (!xmlStrncmp (element->name, "mail-reader", 11)) {
-		    if (is_executable_valid (gnome_da_xml_get_string (element, "executable"))) {
+		    executable = gnome_da_xml_get_string (element, "executable");
+		    if (is_executable_valid (executable)) {
 			mail_item = gnome_da_mail_item_new ();
 
 			mail_item->generic.name = gnome_da_xml_get_string (element, "name");
-			mail_item->generic.executable = gnome_da_xml_get_string (element, "executable");
+			mail_item->generic.executable = executable;
 			mail_item->generic.command = gnome_da_xml_get_string (element, "command");
 			mail_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
 
@@ -178,17 +183,20 @@ gnome_da_xml_load_xml (GnomeDACapplet *c
 
 			capplet->mail_readers = g_list_append (capplet->mail_readers, mail_item);
 		    }
+		    else
+			g_free (executable);
 		}
 	    }
 	}
 	else if (!xmlStrncmp (section->name, "terminals", 9)) {
 	    for (element = section->children; element != NULL; element = element->next) {
 		if (!xmlStrncmp (element->name, "terminal", 8)) {
-		    if (is_executable_valid (gnome_da_xml_get_string (element, "executable"))) {
+		    executable = gnome_da_xml_get_string (element, "executable");
+		    if (is_executable_valid (executable)) {
 			term_item = gnome_da_term_item_new ();
 
 			term_item->generic.name = gnome_da_xml_get_string (element, "name");
-			term_item->generic.executable = gnome_da_xml_get_string (element, "executable");
+			term_item->generic.executable = executable;
 			term_item->generic.command = gnome_da_xml_get_string (element, "command");
 			term_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
 
@@ -196,6 +204,8 @@ gnome_da_xml_load_xml (GnomeDACapplet *c
 
 			capplet->terminals = g_list_append (capplet->terminals, term_item);
 		    }
+		    else
+			g_free (executable);
 		}
 	    }
 	}
@@ -221,4 +231,18 @@ gnome_da_xml_load_list (GnomeDACapplet *
 
     if (capplet->web_browsers == NULL)
 	gnome_da_xml_load_xml (capplet, "./gnome-default-applications.xml");
+}
+
+void
+gnome_da_xml_free (GnomeDACapplet *capplet)
+{
+    g_list_foreach (capplet->web_browsers, (GFunc) gnome_da_web_item_free, NULL);
+    g_list_foreach (capplet->mail_readers, (GFunc) gnome_da_mail_item_free, NULL);
+    g_list_foreach (capplet->terminals, (GFunc) gnome_da_term_item_free, NULL);
+    g_list_free (capplet->web_browsers);
+    g_list_free (capplet->mail_readers);
+    g_list_free (capplet->terminals);
+
+    g_object_unref (capplet->xml);
+    g_free (capplet);
 }
