setlocale returns a string in static storage, so must use strdup
authorPeter Verthez <Peter.Verthez@advalvas.be>
Wed, 16 Jan 2002 17:47:53 +0000 (17:47 +0000)
committerPeter Verthez <Peter.Verthez@advalvas.be>
Wed, 16 Jan 2002 17:47:53 +0000 (17:47 +0000)
(and free it afterwards)

gedcom/multilex.c

index 471f5ac37fed065a388799f7715662a5ac07777e..42b9f5000613e95c959b32e226e89578e1a2fe4a 100644 (file)
@@ -111,7 +111,7 @@ int gedcom_parse_file(char* file_name)
   int result = 1;
   FILE* file;
   
-  char *save_locale  = setlocale(LC_ALL, NULL);
+  char *save_locale  = strdup(setlocale(LC_ALL, NULL));
   char *save_textdom = textdomain(NULL);
   setlocale(LC_ALL, "");
   bindtextdomain(PACKAGE, LOCALEDIR);
@@ -140,6 +140,7 @@ int gedcom_parse_file(char* file_name)
 
   textdomain(save_textdom);
   setlocale(LC_ALL, save_locale);
+  free(save_locale);
   return result;
 }