Checks for closed/uninitialized context and devices. (#93)

This commit is contained in:
Sebastian Zagrodzki
2021-01-15 17:25:29 +01:00
committed by GitHub
parent c9efe54672
commit 0eba1b1264
3 changed files with 51 additions and 10 deletions

View File

@@ -209,7 +209,7 @@ func (d *Device) Close() error {
if d.claimed != nil {
return fmt.Errorf("can't release the device %s, it has an open config %d", d, d.claimed.Desc.Number)
}
d.ctx.libusb.close(d.handle)
d.ctx.closeDev(d)
d.handle = nil
return nil
}