git: 7570b8407958 - stable/13 - __messages_load(): check for calloc() failure

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

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

commit 7570b84079587304058678848a5478784d278c2a
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-02-02 18:07:42 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-09 00:42:45 +0000

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

diff --git a/lib/libc/locale/lmessages.c b/lib/libc/locale/lmessages.c
index fd00fc16a4ea..70de30650346 100644
--- a/lib/libc/locale/lmessages.c
+++ b/lib/libc/locale/lmessages.c
@@ -101,6 +101,8 @@ __messages_load(const char *name, locale_t l)
 {
 	struct xlocale_messages *new = calloc(sizeof(struct xlocale_messages),
 	    1);
+	if (new == NULL)
+		return (NULL);
 	new->header.header.destructor = destruct_messages;
 	if (messages_load_locale(new, &l->using_messages_locale, name) ==
 	    _LDP_ERROR) {