svn commit: r245184 - head/usr.bin/tail
Xin LI
delphij at FreeBSD.org
Tue Jan 8 22:14:46 UTC 2013
Author: delphij
Date: Tue Jan 8 22:14:45 2013
New Revision: 245184
URL: http://svnweb.freebsd.org/changeset/base/245184
Log:
Use calloc() to get zeroed memory.
MFC after: 1 month
Modified:
head/usr.bin/tail/read.c
Modified: head/usr.bin/tail/read.c
==============================================================================
--- head/usr.bin/tail/read.c Tue Jan 8 22:12:45 2013 (r245183)
+++ head/usr.bin/tail/read.c Tue Jan 8 22:14:45 2013 (r245184)
@@ -143,9 +143,8 @@ lines(FILE *fp, const char *fn, off_t of
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;
More information about the svn-src-all
mailing list