git: ef061a2e2978 - main - __ctype_load(): check for calloc() failure
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 03 Feb 2022 02:49:39 UTC
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)) {