__monetary_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
This commit is contained in:
Konstantin Belousov 2022-02-02 20:12:43 +02:00
parent 0fed1e6f18
commit 4d3b84f67c

View File

@ -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) {