Module Name: src
Committed By: nia
Date: Tue Nov 9 09:21:31 UTC 2021
Modified Files:
src/usr.sbin/edquota: edquota.c
Log Message:
edquota(8): convert realloc(x * y) to reallocarr
To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/edquota/edquota.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/edquota/edquota.c
diff -u src/usr.sbin/edquota/edquota.c:1.52 src/usr.sbin/edquota/edquota.c:1.53
--- src/usr.sbin/edquota/edquota.c:1.52 Tue Aug 14 04:53:43 2012
+++ src/usr.sbin/edquota/edquota.c Tue Nov 9 09:21:31 2021
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
#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 @@ clearpriv(int argc, char **argv, const c
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 @@ clearpriv(int argc, char **argv, const c
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;