---
hardware/saleae-logic16/api.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/hardware/saleae-logic16/api.c b/hardware/saleae-logic16/api.c
index c0c4b62..31fd243 100644
--- a/hardware/saleae-logic16/api.c
+++ b/hardware/saleae-logic16/api.c
@@ -323,8 +323,7 @@ static int logic16_dev_open(struct sr_dev_inst *sdi)
libusb_error_name(ret));
break;
}
-
- return SR_ERR;
+ goto fail;
}
if ((ret = logic16_init_device(sdi)) != SR_OK) {
@@ -338,12 +337,21 @@ static int logic16_dev_open(struct sr_dev_inst *sdi)
break;
}
- libusb_free_device_list(devlist, 1);
if (sdi->status != SR_ST_ACTIVE)
- return SR_ERR;
+ goto fail;
return SR_OK;
+
+fail:
+ libusb_free_device_list(devlist, 1);
+ if (usb->devhdl) {
+ libusb_release_interface(usb->devhdl, USB_INTERFACE);
+ libusb_close(usb->devhdl);
+ usb->devhdl = NULL;
+ }
+
+ return SR_ERR;
}
static int dev_open(struct sr_dev_inst *sdi)
--
1.8.3.1
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel