From 91b82bebcb4f476b39a439d31601074c2b019945 Mon Sep 17 00:00:00 2001 From: Luigi Scarso <luigi.scarso@gmail.com> Date: Thu, 6 Apr 2017 15:00:30 +0000 Subject: [PATCH] better restore of old locale with copy --- trunk and tag 1.0.4 [[Split portion of a mixed commit.]] --- source/texk/web2c/luatexdir/lua/luainit.w | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/texk/web2c/luatexdir/lua/luainit.w b/source/texk/web2c/luatexdir/lua/luainit.w index de2bf47cc..c20d02ac6 100644 --- a/source/texk/web2c/luatexdir/lua/luainit.w +++ b/source/texk/web2c/luatexdir/lua/luainit.w @@ -933,7 +933,7 @@ void lua_initialize(int ac, char **av) /* Get the current locale (it should be C ) */ /* and save LC_CTYPE, LC_COLLATE and LC_NUMERIC. */ /* Later luainterpreter() will consciously use them. */ - old_locale = setlocale (LC_ALL, NULL); + old_locale = xstrdup(setlocale (LC_ALL, NULL)); lc_ctype = NULL; lc_collate = NULL; lc_numeric = NULL; @@ -965,6 +965,7 @@ void lua_initialize(int ac, char **av) fprintf(stderr,"Unable to restore original locale:exit now.\n"); exit(1); } + xfree(old_locale); } else { fprintf(stderr,"Unable to store environment locale.\n"); } -- GitLab