Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Feb 2022 02:49:39 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ef061a2e2978 - main - __ctype_load(): check for calloc() failure
Message-ID:  <202202030249.2132ndwf087246@gitrepo.freebsd.org>

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

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

commit ef061a2e2978a5e0fbfe2766ff7ab8f529bbd966
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-02-02 18:17:58 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-03 01:04:00 +0000

    __ctype_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/setrunelocale.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c
index 551d32b7ab6a..41c82e637529 100644
--- a/lib/libc/locale/setrunelocale.c
+++ b/lib/libc/locale/setrunelocale.c
@@ -214,6 +214,8 @@ void *
 __ctype_load(const char *locale, locale_t unused __unused)
 {
 	struct xlocale_ctype *l = calloc(sizeof(struct xlocale_ctype), 1);
+	if (l == NULL)
+		return (NULL);
 
 	l->header.header.destructor = destruct_ctype;
 	if (__setrunelocale(l, locale)) {



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