Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Feb 2022 02:49:31 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: b8ad908ad98a - main - __collate_load(): check for calloc failure
Message-ID:  <202202030249.2132nVR5087058@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=b8ad908ad98a6f2d8ffff979c2abb7895c55a82b

commit b8ad908ad98a6f2d8ffff979c2abb7895c55a82b
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-02-02 18:01:56 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-03 01:03:07 +0000

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

diff --git a/lib/libc/locale/collate.c b/lib/libc/locale/collate.c
index 4365334322cd..2f0e2003aa45 100644
--- a/lib/libc/locale/collate.c
+++ b/lib/libc/locale/collate.c
@@ -90,6 +90,8 @@ __collate_load(const char *encoding, __unused locale_t unused)
 	}
 	struct xlocale_collate *table = calloc(sizeof(struct xlocale_collate),
 	    1);
+	if (table == NULL)
+		return (NULL);
 	table->header.header.destructor = destruct_collate;
 
 	/*



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