From 87151b60e069fd16530fd36aace85d651b936c01 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Wed, 2 Feb 2022 20:16:25 +0200 Subject: [PATCH] __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 1b2a91d3652..32c4b9880c1 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) { -- 2.45.0