diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2022-02-02 17:25:45 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2022-02-09 00:42:45 +0000 |
commit | e1c53fc8e15491d03641736e07c743fcb4324b2f (patch) | |
tree | 0040137c352b9870fb91f6355096936c5bf09c6c /lib/libc/locale | |
parent | 3e4e8d5cbfcd2161d7cdd513ad9d7d88f703fcb8 (diff) |
xlocale.c: only call init_key() when locale was successfully allocated
(cherry picked from commit 7bf532c9d447bfdf03f42a5c5092fb74740722b2)
Diffstat (limited to 'lib/libc/locale')
-rw-r--r-- | lib/libc/locale/xlocale.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/locale/xlocale.c b/lib/libc/locale/xlocale.c index 467d6e6e5aee..4bddc43c086b 100644 --- a/lib/libc/locale/xlocale.c +++ b/lib/libc/locale/xlocale.c @@ -257,13 +257,13 @@ newlocale(int mask, const char *locale, locale_t base) int useenv = 0; int success = 1; - _once(&once_control, init_key); - locale_t new = alloc_locale(); if (NULL == new) { return (NULL); } + _once(&once_control, init_key); + orig_base = base; FIX_LOCALE(base); copyflags(new, base); @@ -312,12 +312,12 @@ duplocale(locale_t base) locale_t new = alloc_locale(); int type; - _once(&once_control, init_key); - if (NULL == new) { return (NULL); } + _once(&once_control, init_key); + FIX_LOCALE(base); copyflags(new, base); |