git: a6ba681b44d7 - stable/13 - __ctype_load(): check for calloc() failure

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 09 Feb 2022 00:48:19 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=a6ba681b44d7048c69d54f9cc8ed57c8b46c912b

commit a6ba681b44d7048c69d54f9cc8ed57c8b46c912b
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-02-02 18:17:58 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-09 00:42:46 +0000

    __ctype_load(): check for calloc() failure
    
    (cherry picked from commit ef061a2e2978a5e0fbfe2766ff7ab8f529bbd966)
---
 lib/libc/locale/setrunelocale.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c
index 551d32b7ab6a..41c82e637529 100644
--- a/lib/libc/locale/setrunelocale.c
+++ b/lib/libc/locale/setrunelocale.c
@@ -214,6 +214,8 @@ void *
 __ctype_load(const char *locale, locale_t unused __unused)
 {
 	struct xlocale_ctype *l = calloc(sizeof(struct xlocale_ctype), 1);
+	if (l == NULL)
+		return (NULL);
 
 	l->header.header.destructor = destruct_ctype;
 	if (__setrunelocale(l, locale)) {