aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/prov/pkcs11/p11_session.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/prov/pkcs11/p11_session.cpp')
-rw-r--r--src/lib/prov/pkcs11/p11_session.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/prov/pkcs11/p11_session.cpp b/src/lib/prov/pkcs11/p11_session.cpp
index ceb316169..71397eea5 100644
--- a/src/lib/prov/pkcs11/p11_session.cpp
+++ b/src/lib/prov/pkcs11/p11_session.cpp
@@ -38,14 +38,21 @@ Session::Session(Slot& slot, SessionHandle handle)
Session::~Session() BOTAN_NOEXCEPT
{
- if(m_handle)
+ try
{
- if(m_logged_in)
+ if(m_handle)
{
- module()->C_Logout(m_handle, nullptr);
+ if(m_logged_in)
+ {
+ module()->C_Logout(m_handle, nullptr);
+ }
+ module()->C_CloseSession(m_handle, nullptr);
+ m_handle = 0;
}
- module()->C_CloseSession(m_handle, nullptr);
- m_handle = 0;
+ }
+ catch(...)
+ {
+ // exception during noexcept destructor is ignored
}
}