diff options
author | delphij <delphij@FreeBSD.org> | 2013-01-08 22:14:45 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2013-01-08 22:14:45 +0000 |
commit | e8148339d56bb9380646157b81c4c0425b20a0a7 (patch) | |
tree | 10f5584f12141bc3de3cb9a2b02b8a97f4959cf5 /usr.bin/tail | |
parent | 3ffe3ebe2e63f09fa43e4e79afe221c3644f3bb3 (diff) | |
download | FreeBSD-src-e8148339d56bb9380646157b81c4c0425b20a0a7.zip FreeBSD-src-e8148339d56bb9380646157b81c4c0425b20a0a7.tar.gz |
Use calloc() to get zeroed memory.
MFC after: 1 month
Diffstat (limited to 'usr.bin/tail')
-rw-r--r-- | usr.bin/tail/read.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.bin/tail/read.c b/usr.bin/tail/read.c index 2cff3a3..79c4fa5 100644 --- a/usr.bin/tail/read.c +++ b/usr.bin/tail/read.c @@ -143,9 +143,8 @@ lines(FILE *fp, const char *fn, off_t off) char *p, *sp; int blen, cnt, recno, wrap; - if ((llines = malloc(off * sizeof(*llines))) == NULL) - err(1, "malloc"); - bzero(llines, off * sizeof(*llines)); + if ((llines = calloc(off, sizeof(*llines))) == NULL) + err(1, "calloc"); p = sp = NULL; blen = cnt = recno = wrap = 0; rc = 0; |