git: bc9ce839f981 - main - __messages_load(): check for calloc() failure
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 03 Feb 2022 02:49:33 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=bc9ce839f9811ee9e3990bb26c00031a84fa50bd
commit bc9ce839f9811ee9e3990bb26c00031a84fa50bd
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-02-02 18:07:42 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-03 01:03:24 +0000
__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
---
lib/libc/locale/lmessages.c | 2 ++
1 file changed, 2 insertions(+)
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) {