Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/edquota edquota(8): convert realloc(x * y) to reall...
details: https://anonhg.NetBSD.org/src/rev/1b6adf8502f2
branches: trunk
changeset: 1025501:1b6adf8502f2
user: nia <nia%NetBSD.org@localhost>
date: Tue Nov 09 09:21:31 2021 +0000
description:
edquota(8): convert realloc(x * y) to reallocarr
diffstat:
usr.sbin/edquota/edquota.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diffs (43 lines):
diff -r 50d47c4a916a -r 1b6adf8502f2 usr.sbin/edquota/edquota.c
--- a/usr.sbin/edquota/edquota.c Tue Nov 09 09:19:01 2021 +0000
+++ b/usr.sbin/edquota/edquota.c Tue Nov 09 09:21:31 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: edquota.c,v 1.52 2012/08/14 04:53:43 dholland Exp $ */
+/* $NetBSD: edquota.c,v 1.53 2021/11/09 09:21:31 nia Exp $ */
/*
* Copyright (c) 1980, 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "from: @(#)edquota.c 8.3 (Berkeley) 4/27/95";
#else
-__RCSID("$NetBSD: edquota.c,v 1.52 2012/08/14 04:53:43 dholland Exp $");
+__RCSID("$NetBSD: edquota.c,v 1.53 2021/11/09 09:21:31 nia Exp $");
#endif
#endif /* not lint */
@@ -639,9 +639,9 @@
maxids = 4;
nids = 0;
- ids = malloc(maxids * sizeof(ids[0]));
- if (ids == NULL) {
- err(1, "malloc");
+ ids = NULL;
+ if (reallocarr(&ids, maxids, sizeof(ids[0])) != 0) {
+ err(1, "reallocarr");
}
for ( ; argc > 0; argc--, argv++) {
@@ -650,9 +650,8 @@
if (nids + 1 > maxids) {
maxids *= 2;
- ids = realloc(ids, maxids * sizeof(ids[0]));
- if (ids == NULL) {
- err(1, "realloc");
+ if (reallocarr(&ids, maxids, sizeof(ids[0])) != 0) {
+ err(1, "reallocarr");
}
}
ids[nids++] = id;
Home |
Main Index |
Thread Index |
Old Index