git: 0f674081c45c - stable/13 - __numeric_load(): check for calloc() failure

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

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

commit 0f674081c45c9cce1731c1fed92250965c004af2
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-02-02 18:16:25 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-09 00:42:46 +0000

    __numeric_load(): check for calloc() failure
    
    (cherry picked from commit 87151b60e069fd16530fd36aace85d651b936c01)
---
 lib/libc/locale/lnumeric.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/libc/locale/lnumeric.c b/lib/libc/locale/lnumeric.c
index d7305505fa65..c75568989c89 100644
--- a/lib/libc/locale/lnumeric.c
+++ b/lib/libc/locale/lnumeric.c
@@ -99,6 +99,8 @@ __numeric_load(const char *name, locale_t l)
 {
 	struct xlocale_numeric *new = calloc(sizeof(struct xlocale_numeric),
 	    1);
+	if (new == NULL)
+		return (NULL);
 	new->header.header.destructor = destruct_numeric;
 	if (numeric_load_locale(new, &l->using_numeric_locale,
 	    &l->numeric_locale_changed, name) == _LDP_ERROR) {