diff options
-rw-r--r-- | src/tests/test_pkcs11_low_level.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/tests/test_pkcs11_low_level.cpp b/src/tests/test_pkcs11_low_level.cpp index feb490cd4..289ff5995 100644 --- a/src/tests/test_pkcs11_low_level.cpp +++ b/src/tests/test_pkcs11_low_level.cpp @@ -49,18 +49,23 @@ class RAII_LowLevel } ~RAII_LowLevel() BOTAN_NOEXCEPT { - - if(m_is_session_open) + try { - if(m_is_logged_in) + if(m_is_session_open) { - m_low_level.get()->C_Logout(m_session_handle, nullptr); - } + if(m_is_logged_in) + { + m_low_level.get()->C_Logout(m_session_handle, nullptr); + } - m_low_level.get()->C_CloseSession(m_session_handle, nullptr); + m_low_level.get()->C_CloseSession(m_session_handle, nullptr); + } + m_low_level.get()->C_Finalize(nullptr, nullptr); + } + catch(...) + { + // ignore errors here } - - m_low_level.get()->C_Finalize(nullptr, nullptr); } std::vector<SlotId> get_slots(bool token_present) const |