__messages_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:07:42 +02:00
parent 5b7e92d48f
commit bc9ce839f9

View File

@ -101,6 +101,8 @@ __messages_load(const char *name, locale_t l)
{
struct xlocale_messages *new = calloc(sizeof(struct xlocale_messages),
1);
if (new == NULL)
return (NULL);
new->header.header.destructor = destruct_messages;
if (messages_load_locale(new, &l->using_messages_locale, name) ==
_LDP_ERROR) {