Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Feb 2022 00:48:13 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 7570b8407958 - stable/13 - __messages_load(): check for calloc() failure
Message-ID:  <202202090048.2190mDTJ083840@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=7570b84079587304058678848a5478784d278c2a

commit 7570b84079587304058678848a5478784d278c2a
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-02-02 18:07:42 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-09 00:42:45 +0000

    __messages_load(): check for calloc() failure
    
    (cherry picked from commit bc9ce839f9811ee9e3990bb26c00031a84fa50bd)
---
 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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202202090048.2190mDTJ083840>