From: Ben Pfaff Date: Tue, 11 Sep 2007 03:12:34 +0000 (+0000) Subject: (psppire_variable_sheet_create): Use xstrdup to save string returned X-Git-Tag: v0.6.0~280 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4b7fda32c476d6b2b5c94d175448f912746e8db;p=pspp-builds.git (psppire_variable_sheet_create): Use xstrdup to save string returned by bind_textdomain_codeset. Otherwise it can get freed by a subsequent call. Patch #6193. Reviewed by John Darrington. --- diff --git a/src/ui/gui/ChangeLog b/src/ui/gui/ChangeLog index 6238e0f7..6c36b520 100644 --- a/src/ui/gui/ChangeLog +++ b/src/ui/gui/ChangeLog @@ -1,3 +1,10 @@ +2007-09-10 Ben Pfaff + + * var-sheet.c (psppire_variable_sheet_create): Use xstrdup to save + string returned by bind_textdomain_codeset. Otherwise it can get + freed by a subsequent call. Patch #6193. Reviewed by John + Darrington. + 2007-09-06 John Darrington * helper.c helper.h (execute_syntax): changed return type to diff --git a/src/ui/gui/var-sheet.c b/src/ui/gui/var-sheet.c index b57cdb57..97ab89cb 100644 --- a/src/ui/gui/var-sheet.c +++ b/src/ui/gui/var-sheet.c @@ -38,6 +38,7 @@ #include #include "localcharset.h" +#include "xalloc.h" #include "psppire-var-store.h" #include "helper.h" #include "psppire-dict.h" @@ -455,7 +456,7 @@ psppire_variable_sheet_create (gchar *widget_name, /* Since this happens inside glade_xml_new, we must prevent strings from * being re-encoded twice */ - codeset = bind_textdomain_codeset (PACKAGE, 0); + codeset = xstrdup (bind_textdomain_codeset (PACKAGE, 0)); bind_textdomain_codeset (PACKAGE, locale_charset ()); for (i = 0 ; i < n_COLS ; ++i ) @@ -468,6 +469,7 @@ psppire_variable_sheet_create (gchar *widget_name, } bind_textdomain_codeset (PACKAGE, codeset); + free (codeset); gtk_widget_show (sheet);