summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Hjelm <hjelmn@me.com>2013-05-16 22:04:18 -0600
committerNathan Hjelm <hjelmn@me.com>2013-06-06 10:45:30 -0600
commit936796f4a6198c67c33f462b33d9ddb5daacc3b7 (patch)
tree396d40fabbd555b62da28e72a4ab7056287e8ba7
parent83331a1182d71d4bcd23304229a8c6ec530f6229 (diff)
downloadlibusb-936796f4a6198c67c33f462b33d9ddb5daacc3b7.tar.gz
darwin: increment the reference counter to the parent device
-rw-r--r--libusb/os/darwin_usb.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c
index 0e06afb..d4e6b9c 100644
--- a/libusb/os/darwin_usb.c
+++ b/libusb/os/darwin_usb.c
@@ -865,6 +865,11 @@ static int process_new_device (struct libusb_context *ctx, io_service_t service)
dev->bus_number = cached_device->location >> 24;
dev->device_address = cached_device->address;
+ /* need to add a reference to the parent device */
+ if (dev->parent_dev) {
+ libusb_ref_device(dev->parent_dev);
+ }
+
(*(priv->dev->device))->GetDeviceSpeed (priv->dev->device, &devSpeed);
switch (devSpeed) {