diff --git a/daemon/call.c b/daemon/call.c index 9024d1837..ab32bce71 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1377,6 +1377,7 @@ static void steal_peer(struct peer *dest, struct peer *src) { sr->stun = srs->stun; sr->rtcp = srs->rtcp; sr->crypto = srs->crypto; + crypto_context_pair_uninit(&srs->crypto); srs->fd.fd = -1; diff --git a/daemon/crypto.h b/daemon/crypto.h index f87b9bfcb..7baec7205 100644 --- a/daemon/crypto.h +++ b/daemon/crypto.h @@ -115,6 +115,12 @@ static inline void crypto_cleanup(struct crypto_context *c) { if (c->crypto_suite->session_key_cleanup) c->crypto_suite->session_key_cleanup(c); } +static inline void crypto_context_pair_uninit(struct crypto_context_pair *p) { + p->in.session_key_ctx[0] = NULL; + p->in.session_key_ctx[1] = NULL; + p->out.session_key_ctx[0] = NULL; + p->out.session_key_ctx[1] = NULL; +}