git: 87151b60e069 - main - __numeric_load(): check for calloc() failure

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

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

commit 87151b60e069fd16530fd36aace85d651b936c01
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-02-02 18:16:25 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-03 01:03:52 +0000

    __numeric_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/lnumeric.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/libc/locale/lnumeric.c b/lib/libc/locale/lnumeric.c
index 1b2a91d3652c..32c4b9880c1e 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) {