git: b8ad908ad98a - main - __collate_load(): check for calloc failure

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Thu, 03 Feb 2022 02:49:31 UTC
The branch main has been updated by kib:

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

commit b8ad908ad98a6f2d8ffff979c2abb7895c55a82b
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-02-02 18:01:56 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-03 01:03:07 +0000

    __collate_load(): check for calloc failure
    
    Noted and reviewed by:  markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D34140
---
 lib/libc/locale/collate.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/libc/locale/collate.c b/lib/libc/locale/collate.c
index 4365334322cd..2f0e2003aa45 100644
--- a/lib/libc/locale/collate.c
+++ b/lib/libc/locale/collate.c
@@ -90,6 +90,8 @@ __collate_load(const char *encoding, __unused locale_t unused)
 	}
 	struct xlocale_collate *table = calloc(sizeof(struct xlocale_collate),
 	    1);
+	if (table == NULL)
+		return (NULL);
 	table->header.header.destructor = destruct_collate;
 
 	/*