summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Hjelm <hjelmn@me.com>2010-07-24 13:42:57 -0600
committerPete Batard <pbatard@gmail.com>2010-07-29 11:24:56 +0100
commit82cb50a5abba7dc0b80a21985d2aeb5ba6a3ed9c (patch)
tree01d1f41cf371558ede3d935e6ad2d7a1d1f7bc76
parenta58e3973ad3c53f65433f9f73c08a70c67763791 (diff)
downloadlibusb-82cb50a5abba7dc0b80a21985d2aeb5ba6a3ed9c.tar.gz
Darwin: fix interface object leak
-rw-r--r--libusb/os/darwin_usb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c
index 2af7b27..292e79c 100644
--- a/libusb/os/darwin_usb.c
+++ b/libusb/os/darwin_usb.c
@@ -748,8 +748,11 @@ static int darwin_get_interface (usb_device_t **darwin_device, uint8_t ifc, io_s
if (kresult)
return kresult;
- for ( current_interface = 0 ; current_interface <= ifc ; current_interface++ )
+ for ( current_interface = 0 ; current_interface <= ifc ; current_interface++ ) {
*usbInterfacep = IOIteratorNext(interface_iterator);
+ if (current_interface != ifc)
+ (void) IOObjectRelease (*usbInterfacep);
+ }
/* done with the interface iterator */
IOObjectRelease(interface_iterator);