Fix for double-free and segfault after close
authorNathan Fraser <ndf@undershorts.org>
Mon, 27 Jul 2009 11:19:11 +0000 (21:19 +1000)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 27 Jul 2009 20:13:12 +0000 (22:13 +0200)
commitdff4fdb0a64ea5b3cb03d9ff66374cbf05e5e0dc
tree41c69242200ca6667539ae447f515a7eed448d86
parente3d9bcdd6771a2464cd832b96e3da26a3ad804ac
Fix for double-free and segfault after close

In some circumstances it is possible to send an invalid usb_dev
pointer through to libusb after some errors or after an explicit
close request. Result will be segfault or subtle corruption.
This patch replaces all calls to usb_close with an internal wrapper
that sets the usb handle to NULL after the usb_close, and refuses
to call close on a NULL handle. Comments and/or discussion very welcome!
src/ftdi.c