aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2022-02-02 18:07:42 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2022-02-09 00:42:45 +0000
commit7570b84079587304058678848a5478784d278c2a (patch)
tree26802ca61f0713a1d9fbc0dd0c4bbaaab4fe1325 /lib
parentf6d081188411dd0e4f3ea03f4e9c12a9f4e0107c (diff)
downloadsrc-7570b84079587304058678848a5478784d278c2a.tar.gz
src-7570b84079587304058678848a5478784d278c2a.zip
__messages_load(): check for calloc() failure
(cherry picked from commit bc9ce839f9811ee9e3990bb26c00031a84fa50bd)
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/locale/lmessages.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libc/locale/lmessages.c b/lib/libc/locale/lmessages.c
index fd00fc16a4ea..70de30650346 100644
--- a/lib/libc/locale/lmessages.c
+++ b/lib/libc/locale/lmessages.c
@@ -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) {