Just pass M_ZERO to malloc(9) instead of clearing allocated memory separately.

This commit is contained in:
Pawel Jakub Dawidek 2010-12-14 06:19:13 +00:00
parent 82db8a5e35
commit b452cf6317

View File

@ -1888,8 +1888,7 @@ kern_sendfile(struct thread *td, struct sendfile_args *uap,
mnw = 1;
if (uap->flags & SF_SYNC) {
sfs = malloc(sizeof *sfs, M_TEMP, M_WAITOK);
memset(sfs, 0, sizeof *sfs);
sfs = malloc(sizeof *sfs, M_TEMP, M_WAITOK | M_ZERO);
mtx_init(&sfs->mtx, "sendfile", NULL, MTX_DEF);
cv_init(&sfs->cv, "sendfile");
}