summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-10-14 12:17:50 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-10-19 16:34:10 +0200
commit18f427f6bf50f64ba3b4b2c1c1dd168f0c8fdb76 (patch)
treec1b46f98aa5b3c13cc4f2799e53201c6762ec804
parent21b98b2174cc13b1fc99d4f1c2155e170465a37f (diff)
downloadlibnitrokey-18f427f6bf50f64ba3b4b2c1c1dd168f0c8fdb76.tar.gz
libnitrokey-18f427f6bf50f64ba3b4b2c1c1dd168f0c8fdb76.tar.bz2
Fixed bug with not releasing device on disconnect
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--device.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/device.cc b/device.cc
index 6660276..a420a64 100644
--- a/device.cc
+++ b/device.cc
@@ -21,8 +21,10 @@ Device::Device()
bool Device::disconnect() {
Log::instance()(__PRETTY_FUNCTION__, Loglevel::DEBUG_L2);
- hid_exit();
+ if(mp_devhandle== nullptr) return false;
+ hid_close(mp_devhandle);
mp_devhandle = NULL;
+ hid_exit();
return true;
}
bool Device::connect() {