git: 23da067dd4c7 - stable/13 - __monetary_load(): check for calloc() failure

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

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

commit 23da067dd4c77ba52c64c0661f7e903061290b67
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-02-02 18:12:43 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-09 00:42:45 +0000

    __monetary_load(): check for calloc() failure
    
    (cherry picked from commit 4d3b84f67c2e1c75414ba52578364e729f425103)
---
 lib/libc/locale/lmonetary.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/libc/locale/lmonetary.c b/lib/libc/locale/lmonetary.c
index c8811e8d59a4..cdf4af79c3ab 100644
--- a/lib/libc/locale/lmonetary.c
+++ b/lib/libc/locale/lmonetary.c
@@ -162,6 +162,8 @@ __monetary_load(const char *name, locale_t l)
 {
 	struct xlocale_monetary *new = calloc(sizeof(struct xlocale_monetary),
 	    1);
+	if (new == NULL)
+		return (NULL);
 	new->header.header.destructor = destruct_monetary;
 	if (monetary_load_locale_l(new, &l->using_monetary_locale,
 	    &l->monetary_locale_changed, name) == _LDP_ERROR) {