[evolution] Fix a potential crasher in e_charset_add_radio_actions().



commit 519d4a3de509e2e5120630ae56c06ded2f329f81
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Feb 8 19:13:35 2010 -0500

    Fix a potential crasher in e_charset_add_radio_actions().

 e-util/e-charset.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/e-util/e-charset.c b/e-util/e-charset.c
index ffee5a8..d2b7a91 100644
--- a/e-util/e-charset.c
+++ b/e-util/e-charset.c
@@ -228,10 +228,12 @@ e_charset_add_radio_actions (GtkActionGroup *action_group,
 		action = gtk_radio_action_new (
 			action_name, charset_label, NULL, NULL, def);
 
-		/* Character set name is static so no need to free it. */
-		g_object_set_data (
+		/* Character set name may NOT be static,
+		 * so we do need to duplicate the string. */
+		g_object_set_data_full (
 			G_OBJECT (action), "charset",
-			(gpointer) charset_name);
+			g_strdup (charset_name),
+			(GDestroyNotify) g_free);
 
 		gtk_radio_action_set_group (action, group);
 		group = gtk_radio_action_get_group (action);



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