forked from M-Labs/artiq
lda_controller: fix memory leak
This commit is contained in:
parent
26180e7905
commit
9c41f98d70
|
@ -138,11 +138,12 @@ class Lda:
|
||||||
def enumerate(cls, product):
|
def enumerate(cls, product):
|
||||||
devs = hidapi.hid_enumerate(cls._vendor_id,
|
devs = hidapi.hid_enumerate(cls._vendor_id,
|
||||||
cls._product_ids[product])
|
cls._product_ids[product])
|
||||||
|
try:
|
||||||
dev = devs
|
dev = devs
|
||||||
while dev:
|
while dev:
|
||||||
yield dev[0].serial
|
yield dev[0].serial
|
||||||
dev = dev[0].next
|
dev = dev[0].next
|
||||||
yield None
|
finally:
|
||||||
hidapi.hid_free_enumeration(devs)
|
hidapi.hid_free_enumeration(devs)
|
||||||
|
|
||||||
def _check_error(self, ret):
|
def _check_error(self, ret):
|
||||||
|
|
Loading…
Reference in New Issue