diff options
author | Vitali Lovich <vlovich@gmail.com> | 2011-09-16 08:48:28 -0600 |
---|---|---|
committer | Peter Stuge <peter@stuge.se> | 2011-10-17 16:25:50 +0200 |
commit | 8a2f7b5c0520e6099f2c624cd0994c60867c1628 (patch) | |
tree | 15cba46de2722a2b4cb5b8598e9f692299627ed0 /libusb/os/darwin_usb.c | |
parent | b1ee2ef8d0b67dcc51c15742cb2decb386cffd9b (diff) | |
download | libusbx-8a2f7b5c0520e6099f2c624cd0994c60867c1628.tar.gz |
Darwin: fix potential leak on libusb_claim_interface() error
Diffstat (limited to 'libusb/os/darwin_usb.c')
-rw-r--r-- | libusb/os/darwin_usb.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c index 5451f23..6e9d36f 100644 --- a/libusb/os/darwin_usb.c +++ b/libusb/os/darwin_usb.c @@ -1040,6 +1040,10 @@ static int darwin_claim_interface(struct libusb_device_handle *dev_handle, int i /* get an interface to the device's interface */ kresult = IOCreatePlugInInterfaceForService (usbInterface, kIOUSBInterfaceUserClientTypeID, kIOCFPlugInInterfaceID, &plugInInterface, &score); + + /* ignore release error */ + (void)IOObjectRelease (usbInterface); + if (kresult) { usbi_err (HANDLE_CTX (dev_handle), "IOCreatePlugInInterfaceForService: %s", darwin_error_str(kresult)); return darwin_to_libusb (kresult); @@ -1050,9 +1054,6 @@ static int darwin_claim_interface(struct libusb_device_handle *dev_handle, int i return LIBUSB_ERROR_NOT_FOUND; } - /* ignore release error */ - (void)IOObjectRelease (usbInterface); - /* Do the actual claim */ kresult = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID), |