summaryrefslogtreecommitdiffstats
path: root/usr.bin/grep/grep.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2010-07-23 19:36:11 +0000
committerdelphij <delphij@FreeBSD.org>2010-07-23 19:36:11 +0000
commitaa17bd87c6841106f418283b6ef59509d82dd6e5 (patch)
tree45af8c90a23de241b56a045dd3516dd2b7cd78ef /usr.bin/grep/grep.c
parent0c709bf1093eb3e3a2535ee09725b7dd5b635c2f (diff)
downloadFreeBSD-src-aa17bd87c6841106f418283b6ef59509d82dd6e5.zip
FreeBSD-src-aa17bd87c6841106f418283b6ef59509d82dd6e5.tar.gz
Fix crashes when using grep -R:
- Explicitly pre-zero memory for fts_open parameters. - Don't test against directory patterns when we are testing direct leaf of current directory. While I'm there plug a few of memory leaks.
Diffstat (limited to 'usr.bin/grep/grep.c')
-rw-r--r--usr.bin/grep/grep.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c
index 9b8b52f..1703c70 100644
--- a/usr.bin/grep/grep.c
+++ b/usr.bin/grep/grep.c
@@ -351,8 +351,8 @@ main(int argc, char *argv[])
}
eargv[++eargc] = NULL;
- aargv = (char **)grep_malloc(sizeof(char *) *
- (eargc + argc + 1));
+ aargv = (char **)grep_calloc(eargc + argc + 1,
+ sizeof(char *));
aargv[0] = argv[0];
for(i = 1; i < eargc; i++)
OpenPOWER on IntegriCloud