diff --git a/src/MySqlConnector/Core/ServerSession.cs b/src/MySqlConnector/Core/ServerSession.cs index e1f94540f..e8aeb45e7 100644 --- a/src/MySqlConnector/Core/ServerSession.cs +++ b/src/MySqlConnector/Core/ServerSession.cs @@ -1258,7 +1258,7 @@ private async Task InitSslAsync(ProtocolCapabilities serverCapabilities, Connect try { var storeLocation = (cs.CertificateStoreLocation == MySqlCertificateStoreLocation.CurrentUser) ? StoreLocation.CurrentUser : StoreLocation.LocalMachine; - var store = new X509Store(StoreName.My, storeLocation); + using var store = new X509Store(StoreName.My, storeLocation); store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly); if (cs.CertificateThumbprint.Length == 0) @@ -1743,7 +1743,7 @@ private void VerifyState(State state1, State state2, State state3, State state4, { if (m_state != state1 && m_state != state2 && m_state != state3 && m_state != state4 && m_state != state5 && m_state != state6) { - ExpectedSessionState6(m_logger, Id, state1, state2, state3, state4, state5, state5, m_state); + ExpectedSessionState6(m_logger, Id, state1, state2, state3, state4, state5, state6, m_state); throw new InvalidOperationException($"Expected state to be ({state1}|{state2}|{state3}|{state4}|{state5}|{state6}) but was {m_state}."); } }