summaryrefslogtreecommitdiff
path: root/libusb/os/darwin_usb.c
diff options
context:
space:
mode:
authorNathan Hjelm <hjelmn@mac.com>2009-08-23 10:02:55 +0545
committerDaniel Drake <dsd@gentoo.org>2009-08-23 10:02:55 +0545
commitad8ae04d0b52009af0b1180e005f7554d2bbb26c (patch)
treeb103e3d88594d2b473b10b71de398d77d409d7f1 /libusb/os/darwin_usb.c
parent45ae2aecf5512dcff059b2a416534e81c6a00c88 (diff)
downloadlibusb-ad8ae04d0b52009af0b1180e005f7554d2bbb26c.tar.gz
Darwin: fix crash when reading descriptors after close
Fix a crash which occurs if the user does the following sequence on a device: open, close, get_configuration_descriptor.
Diffstat (limited to 'libusb/os/darwin_usb.c')
-rw-r--r--libusb/os/darwin_usb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c
index 9e12e07..8c1afec 100644
--- a/libusb/os/darwin_usb.c
+++ b/libusb/os/darwin_usb.c
@@ -652,6 +652,9 @@ static void darwin_close (struct libusb_device_handle *dev_handle) {
usbi_remove_pollfd (HANDLE_CTX (dev_handle), priv->fds[0]);
close (priv->fds[1]);
close (priv->fds[0]);
+
+ dpriv->device = NULL;
+ priv->fds[0] = priv->fds[1] = -1;
}
static int darwin_get_configuration(struct libusb_device_handle *dev_handle, int *config) {