python-pillow / Sane

Python interface to the SANE scanner and frame grabber
Other
54 stars 19 forks source link

Sane leaks filedescriptors #93

Open emdete opened 2 weeks ago

emdete commented 2 weeks ago

the init/exit sequence is not cleaning up all resources. this short sequence shows the case:

from sane import init, get_devices, exit as deinit

for _ in range(99):
    init()
    d = get_devices()
    with open("/etc/hosts") as f:
        print(f.fileno())
    deinit()

as you can see the fd will increase (by 78 in my case).