0
0
mirror of https://github.com/keepassxreboot/keepassxc.git synced 2024-09-20 12:22:16 +02:00

fix(YubiKey): call yk_release on errors

Fix #2643 and #2721
This commit is contained in:
Johan Fleury 2019-02-27 21:18:20 -05:00 committed by Jonathan White
parent f997e86869
commit a2bd08ca8a
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01

View File

@ -77,6 +77,7 @@ bool YubiKey::init()
// TODO: handle multiple attached hardware devices
m_yk_void = static_cast<void*>(yk_open_first_key());
if (m_yk == nullptr) {
yk_release();
m_mutex.unlock();
return false;
}
@ -85,6 +86,7 @@ bool YubiKey::init()
if (m_ykds == nullptr) {
yk_close_key(m_yk);
m_yk_void = nullptr;
yk_release();
m_mutex.unlock();
return false;
}
@ -107,6 +109,8 @@ bool YubiKey::deinit()
m_ykds_void = nullptr;
}
yk_release();
m_mutex.unlock();
return true;