diff options
author | delphij <delphij@FreeBSD.org> | 2010-07-23 19:36:11 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2010-07-23 19:36:11 +0000 |
commit | aa17bd87c6841106f418283b6ef59509d82dd6e5 (patch) | |
tree | 45af8c90a23de241b56a045dd3516dd2b7cd78ef /usr.bin/grep/grep.c | |
parent | 0c709bf1093eb3e3a2535ee09725b7dd5b635c2f (diff) | |
download | FreeBSD-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.c | 4 |
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++) |