aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/find/function.c
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2001-07-24 14:12:05 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2001-07-24 14:12:05 +0000
commitf0cb9537214cd3bcb60e3b3f49580ea11153ff10 (patch)
tree406ef9426f8d043031e8e848c605676a503dd041 /usr.bin/find/function.c
parentac3c230c828d3fef1f9468266028cfd13809393f (diff)
Notes
Diffstat (limited to 'usr.bin/find/function.c')
-rw-r--r--usr.bin/find/function.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index a60c4c41a2b9..1de472bd8b7e 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -515,15 +515,20 @@ c_exec(option, argvp)
}
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));
+ if ((new->e_argv = malloc((u_int)cnt * sizeof(char *))) == NULL)
+ err(1, (char *)NULL);
+ if ((new->e_orig = malloc((u_int)cnt * sizeof(char *))) == NULL)
+ err(1, (char *)NULL);
+ if ((new->e_len = malloc((u_int)cnt * sizeof(int))) == NULL)
+ err(1, (char *)NULL);
for (argv = *argvp, cnt = 0; argv < ap; ++argv, ++cnt) {
new->e_orig[cnt] = *argv;
for (p = *argv; *p; ++p)
if (p[0] == '{' && p[1] == '}') {
- new->e_argv[cnt] = emalloc((u_int)MAXPATHLEN);
+ if ((new->e_argv[cnt] =
+ malloc((u_int)MAXPATHLEN)) == NULL)
+ err(1, (char *)NULL);
new->e_len[cnt] = MAXPATHLEN;
break;
}