git: 4d3b84f67c2e - main - __monetary_load(): check for calloc() failure
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 03 Feb 2022 02:49:35 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=4d3b84f67c2e1c75414ba52578364e729f425103
commit 4d3b84f67c2e1c75414ba52578364e729f425103
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-02-02 18:12:43 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-03 01:03:35 +0000
__monetary_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/lmonetary.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/libc/locale/lmonetary.c b/lib/libc/locale/lmonetary.c
index cbd531d9416c..ff11f26e890b 100644
--- a/lib/libc/locale/lmonetary.c
+++ b/lib/libc/locale/lmonetary.c
@@ -162,6 +162,8 @@ __monetary_load(const char *name, locale_t l)
{
struct xlocale_monetary *new = calloc(sizeof(struct xlocale_monetary),
1);
+ if (new == NULL)
+ return (NULL);
new->header.header.destructor = destruct_monetary;
if (monetary_load_locale_l(new, &l->using_monetary_locale,
&l->monetary_locale_changed, name) == _LDP_ERROR) {