From: Peter Verthez Date: Wed, 16 Jan 2002 17:47:53 +0000 (+0000) Subject: setlocale returns a string in static storage, so must use strdup X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=753c95b3cec1f7625c68d11b2d4f5786064566a1;p=gedcom-parse.git setlocale returns a string in static storage, so must use strdup (and free it afterwards) --- diff --git a/gedcom/multilex.c b/gedcom/multilex.c index 471f5ac..42b9f50 100644 --- a/gedcom/multilex.c +++ b/gedcom/multilex.c @@ -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; }