Use calloc() to get zeroed memory.
MFC after: 1 month
This commit is contained in:
parent
f29c6bdec5
commit
dea85013f1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=245184
@ -143,9 +143,8 @@ lines(FILE *fp, const char *fn, off_t off)
|
|||||||
char *p, *sp;
|
char *p, *sp;
|
||||||
int blen, cnt, recno, wrap;
|
int blen, cnt, recno, wrap;
|
||||||
|
|
||||||
if ((llines = malloc(off * sizeof(*llines))) == NULL)
|
if ((llines = calloc(off, sizeof(*llines))) == NULL)
|
||||||
err(1, "malloc");
|
err(1, "calloc");
|
||||||
bzero(llines, off * sizeof(*llines));
|
|
||||||
p = sp = NULL;
|
p = sp = NULL;
|
||||||
blen = cnt = recno = wrap = 0;
|
blen = cnt = recno = wrap = 0;
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user