Fix crash when running under windows with non-english locale
[pspp-builds.git] / src / libpspp / i18n.c
index db851217c80be27ae129a9c6252824929af51785..1028d0be32d157c16e3d3a54a3a013c365999ef4 100644 (file)
@@ -227,7 +227,7 @@ get_system_decimal (void)
 {
   char radix_char;
 
-  char *ol = setlocale (LC_NUMERIC, NULL);
+  char *ol = strdup (setlocale (LC_NUMERIC, NULL));
   setlocale (LC_NUMERIC, "");
 
 #if HAVE_NL_LANGINFO
@@ -243,6 +243,7 @@ get_system_decimal (void)
   /* We MUST leave LC_NUMERIC untouched, since it would
      otherwise interfere with data_{in,out} */
   setlocale (LC_NUMERIC, ol);
+  free (ol);
   return radix_char;
 }