git: 7bf532c9d447 - main - xlocale.c: only call init_key() when locale was successfully allocated
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 03 Feb 2022 02:49:28 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=7bf532c9d447bfdf03f42a5c5092fb74740722b2
commit 7bf532c9d447bfdf03f42a5c5092fb74740722b2
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-02-02 17:25:45 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-03 01:02:59 +0000
xlocale.c: only call init_key() when locale was successfully allocated
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34140
---
lib/libc/locale/xlocale.c | 8 ++++----
1 file 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);