diff --git a/src/iocore/net/SSLCertLookup.cc b/src/iocore/net/SSLCertLookup.cc index fc715fc5f90..1f202a45c00 100644 --- a/src/iocore/net/SSLCertLookup.cc +++ b/src/iocore/net/SSLCertLookup.cc @@ -233,24 +233,24 @@ ssl_create_ticket_keyblock(const char *ticket_key_path) SSLCertContext::SSLCertContext(SSLCertContext const &other) { + std::lock_guard lock(other.ctx_mutex); opt = other.opt; userconfig = other.userconfig; keyblock = other.keyblock; ctx_type = other.ctx_type; - std::lock_guard lock(other.ctx_mutex); - ctx = other.ctx; + ctx = other.ctx; } SSLCertContext & SSLCertContext::operator=(SSLCertContext const &other) { if (&other != this) { + std::scoped_lock lock(this->ctx_mutex, other.ctx_mutex); this->opt = other.opt; this->userconfig = other.userconfig; this->keyblock = other.keyblock; this->ctx_type = other.ctx_type; - std::lock_guard lock(other.ctx_mutex); - this->ctx = other.ctx; + this->ctx = other.ctx; } return *this; }