From 5158e2c0f4f93a3b1a9dbce39a8b011732a71141 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 5 Jun 2021 23:02:14 +0200 Subject: global: destroy rwlocks and mtxs Before, most uses of rwlock and mtx never called the destroy method, which might cause problems for witness. Signed-off-by: Jason A. Donenfeld --- src/wg_noise.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/wg_noise.c') diff --git a/src/wg_noise.c b/src/wg_noise.c index 41f7f50..35784be 100644 --- a/src/wg_noise.c +++ b/src/wg_noise.c @@ -220,6 +220,9 @@ noise_local_put(struct noise_local *l) if (refcount_release(&l->l_refcnt)) { if (l->l_cleanup != NULL) l->l_cleanup(l); + rw_destroy(&l->l_identity_lock); + rw_destroy(&l->l_remote_lock); + rw_destroy(&l->l_index_lock); explicit_bzero(l, sizeof(*l)); free(l, M_NOISE); } @@ -468,6 +471,8 @@ noise_remote_smr_free(struct epoch_context *smr) if (r->r_cleanup != NULL) r->r_cleanup(r); noise_local_put(r->r_local); + rw_destroy(&r->r_handshake_lock); + rw_destroy(&r->r_keypair_lock); explicit_bzero(r, sizeof(*r)); free(r, M_NOISE); } @@ -749,6 +754,7 @@ noise_keypair_smr_free(struct epoch_context *smr) struct noise_keypair *kp; 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); } -- cgit v1.2.3-59-g8ed1b