diff options
-rw-r--r-- | src/disk.c | 7 | ||||
-rw-r--r-- | src/disk.h | 1 | ||||
-rw-r--r-- | src/operations.c | 5 |
3 files changed, 12 insertions, 1 deletions
@@ -413,6 +413,13 @@ int disk_init(struct usb_device_info * dev) { } +void disk_exit(struct usb_device_info * dev) { + + if ( dev->data >= 0 ) + close(dev->data); + +} + enum device disk_get_device(struct usb_device_info * dev) { return dev->device; @@ -24,6 +24,7 @@ #include "usb-device.h" int disk_init(struct usb_device_info * dev); +void disk_exit(struct usb_device_info * dev); enum device disk_get_device(struct usb_device_info * dev); diff --git a/src/operations.c b/src/operations.c index cd7ef44..b3be2c7 100644 --- a/src/operations.c +++ b/src/operations.c @@ -91,8 +91,11 @@ clean: void dev_free(struct device_info * dev) { - if ( dev->usb ) + if ( dev->usb ) { + if ( dev->usb->flash_device->protocol == FLASH_DISK ) + disk_exit(dev->usb); usb_close_device(dev->usb); + } free(dev); } |