xlocale.c: check for allocation failure

PR:	261679
Reported by:	phil.stone@gmx.com
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 19:24:42 +02:00
parent fcdf9d7de5
commit b68522308d
1 changed files with 3 additions and 0 deletions

View File

@ -198,6 +198,9 @@ alloc_locale(void)
{
locale_t new = calloc(sizeof(struct _xlocale), 1);
if (new == NULL)
return (NULL);
new->header.destructor = destruct_locale;
new->monetary_locale_changed = 1;
new->numeric_locale_changed = 1;