Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gen setmode(3): use reallocarr instead of malloc(x ...
details: https://anonhg.NetBSD.org/src/rev/83f2cbea9562
branches: trunk
changeset: 363420:83f2cbea9562
user: nia <nia%NetBSD.org@localhost>
date: Sat Mar 12 08:28:30 2022 +0000
description:
setmode(3): use reallocarr instead of malloc(x * y)
diffstat:
lib/libc/gen/setmode.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diffs (32 lines):
diff -r 0aef19fcc525 -r 83f2cbea9562 lib/libc/gen/setmode.c
--- a/lib/libc/gen/setmode.c Sat Mar 12 08:26:01 2022 +0000
+++ b/lib/libc/gen/setmode.c Sat Mar 12 08:28:30 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: setmode.c,v 1.34 2012/06/25 22:32:43 abs Exp $ */
+/* $NetBSD: setmode.c,v 1.35 2022/03/12 08:28:30 nia Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)setmode.c 8.2 (Berkeley) 3/25/94";
#else
-__RCSID("$NetBSD: setmode.c,v 1.34 2012/06/25 22:32:43 abs Exp $");
+__RCSID("$NetBSD: setmode.c,v 1.35 2022/03/12 08:28:30 nia Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -205,9 +205,11 @@
(void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
setlen = SET_LEN + 2;
-
- if ((set = malloc((u_int)(sizeof(BITCMD) * setlen))) == NULL)
+ set = NULL;
+ if (reallocarr(&set, setlen, sizeof(BITCMD)) != 0) {
+ errno = ENOMEM;
return (NULL);
+ }
saveset = set;
endset = set + (setlen - 2);
Home |
Main Index |
Thread Index |
Old Index