summaryrefslogtreecommitdiff
path: root/usr.bin/find/function.c
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2014-05-18 08:10:01 +0000
committerMarc Espie <espie@cvs.openbsd.org>2014-05-18 08:10:01 +0000
commitca2bb4374aeb6d129f5f9e94e69dbad382f7792c (patch)
treef7d9d40c0d466b826aaf7953ba0e9a3e22cbe006 /usr.bin/find/function.c
parentbf73e6ad642681c23ce61a4a312483138e3811e2 (diff)
use reallocarray
okay chl@, tedu@
Diffstat (limited to 'usr.bin/find/function.c')
-rw-r--r--usr.bin/find/function.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index de0ba09295a..cb9542ecff8 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: function.c,v 1.40 2013/04/20 04:52:24 deraadt Exp $ */
+/* $OpenBSD: function.c,v 1.41 2014/05/18 08:10:00 espie Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -537,8 +537,8 @@ c_exec(char *unused, char ***argvp, int isok)
cnt = ap - *argvp - 1; /* units are words */
new->ep_maxargs = 5000;
- new->e_argv = (char **)emalloc((u_int)(cnt + new->ep_maxargs)
- * sizeof(char **));
+ new->e_argv = ereallocarray(NULL,
+ (size_t)(cnt + new->ep_maxargs), sizeof(char **));
/* We start stuffing arguments after the user's last one. */
new->ep_bxp = &new->e_argv[cnt];
@@ -566,9 +566,9 @@ c_exec(char *unused, char ***argvp, int isok)
new->ep_rval = 0;
} else { /* !F_PLUSSET */
cnt = ap - *argvp + 1;
- new->e_argv = (char **)emalloc((u_int)cnt * sizeof(char *));
- new->e_orig = (char **)emalloc((u_int)cnt * sizeof(char *));
- new->e_len = (int *)emalloc((u_int)cnt * sizeof(int));
+ new->e_argv = ereallocarray(NULL, cnt, sizeof(char *));
+ new->e_orig = ereallocarray(NULL, cnt, sizeof(char *));
+ new->e_len = ereallocarray(NULL, cnt, sizeof(int));
for (argv = *argvp, cnt = 0; argv < ap; ++argv, ++cnt) {
new->e_orig[cnt] = *argv;
@@ -685,9 +685,9 @@ c_execdir(char *ignored, char ***argvp, int unused)
}
cnt = ap - *argvp + 1;
- new->e_argv = (char **)emalloc((u_int)cnt * sizeof(char *));
- new->e_orig = (char **)emalloc((u_int)cnt * sizeof(char *));
- new->e_len = (int *)emalloc((u_int)cnt * sizeof(int));
+ new->e_argv = ereallocarray(NULL, cnt, sizeof(char *));
+ new->e_orig = ereallocarray(NULL, cnt, sizeof(char *));
+ new->e_len = ereallocarray(NULL, cnt, sizeof(int));
for (argv = *argvp, cnt = 0; argv < ap; ++argv, ++cnt) {
new->e_orig[cnt] = *argv;