Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Feb 2022 00:48:07 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: 3e4e8d5cbfcd - stable/13 - xlocale.c: check for allocation failure
Message-ID:  <202202090048.2190m7NC083697@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=3e4e8d5cbfcd2161d7cdd513ad9d7d88f703fcb8

commit 3e4e8d5cbfcd2161d7cdd513ad9d7d88f703fcb8
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-02-02 17:24:42 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-09 00:42:45 +0000

    xlocale.c: check for allocation failure
    
    PR:     261679
    
    (cherry picked from commit b68522308d1e0b19c00d82c13878a693fc2ef2df)
---
 lib/libc/locale/xlocale.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/libc/locale/xlocale.c b/lib/libc/locale/xlocale.c
index e07568775394..467d6e6e5aee 100644
--- a/lib/libc/locale/xlocale.c
+++ b/lib/libc/locale/xlocale.c
@@ -198,6 +198,9 @@ alloc_locale(void)
 {
 	locale_t new = calloc(sizeof(struct _xlocale), 1);
 
+	if (new == NULL)
+		return (NULL);
+
 	new->header.destructor = destruct_locale;
 	new->monetary_locale_changed = 1;
 	new->numeric_locale_changed = 1;



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