wg: Use zfree.

Reviewed by:	kevans, markj, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36911
This commit is contained in:
John Baldwin 2022-10-28 13:36:13 -07:00
parent e32e1a160e
commit dcf581bb49
2 changed files with 5 additions and 10 deletions

View File

@ -2452,8 +2452,7 @@ wgc_set(struct wg_softc *sc, struct wg_data_io *wgd)
sx_xunlock(&sc->sc_lock);
nvlist_destroy(nvl);
out:
explicit_bzero(nvlpacked, wgd->wgd_size);
free(nvlpacked, M_TEMP);
zfree(nvlpacked, M_TEMP);
return (err);
}
@ -2577,8 +2576,7 @@ wgc_get(struct wg_softc *sc, struct wg_data_io *wgd)
wgd->wgd_size = size;
out:
explicit_bzero(packed, size);
free(packed, M_NVLIST);
zfree(packed, M_NVLIST);
err:
nvlist_destroy(nvl);
return (err);

View File

@ -223,8 +223,7 @@ noise_local_put(struct noise_local *l)
rw_destroy(&l->l_identity_lock);
mtx_destroy(&l->l_remote_mtx);
mtx_destroy(&l->l_index_mtx);
explicit_bzero(l, sizeof(*l));
free(l, M_NOISE);
zfree(l, M_NOISE);
}
}
@ -472,8 +471,7 @@ noise_remote_smr_free(struct epoch_context *smr)
noise_local_put(r->r_local);
rw_destroy(&r->r_handshake_lock);
mtx_destroy(&r->r_keypair_mtx);
explicit_bzero(r, sizeof(*r));
free(r, M_NOISE);
zfree(r, M_NOISE);
}
void
@ -754,8 +752,7 @@ noise_keypair_smr_free(struct epoch_context *smr)
kp = __containerof(smr, struct noise_keypair, kp_smr);
noise_remote_put(kp->kp_remote);
rw_destroy(&kp->kp_nonce_lock);
explicit_bzero(kp, sizeof(*kp));
free(kp, M_NOISE);
zfree(kp, M_NOISE);
}
void