diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2022-02-02 17:24:42 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2022-02-03 01:02:58 +0000 |
commit | b68522308d1e0b19c00d82c13878a693fc2ef2df (patch) | |
tree | f3b4d9d66fd85380f5d365eca76a9f490fa0f621 | |
parent | fcdf9d7de5363259e33be29bccc8b2b5dc091af8 (diff) | |
download | src-b68522308d1e0b19c00d82c13878a693fc2ef2df.tar.gz src-b68522308d1e0b19c00d82c13878a693fc2ef2df.zip |
xlocale.c: check for allocation failure
PR: 261679
Reported by: phil.stone@gmx.com
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34140
-rw-r--r-- | lib/libc/locale/xlocale.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libc/locale/xlocale.c b/lib/libc/locale/xlocale.c index e07568775394..467d6e6e5aee 100644 --- a/lib/libc/locale/xlocale.c +++ b/lib/libc/locale/xlocale.c @@ -198,6 +198,9 @@ alloc_locale(void) { locale_t new = calloc(sizeof(struct _xlocale), 1); + if (new == NULL) + return (NULL); + new->header.destructor = destruct_locale; new->monetary_locale_changed = 1; new->numeric_locale_changed = 1; |