}
ep = find_endpoint(config, endpoint);
- if (!ep)
- return LIBUSB_ERROR_NOT_FOUND;
+ if (!ep) {
+ r = LIBUSB_ERROR_NOT_FOUND;
+ goto out;
+ }
r = ep->wMaxPacketSize;
+
+out:
libusb_free_config_descriptor(config);
return r;
}
}
ep = find_endpoint(config, endpoint);
- if (!ep)
- return LIBUSB_ERROR_NOT_FOUND;
+ if (!ep) {
+ r = LIBUSB_ERROR_NOT_FOUND;
+ goto out;
+ }
val = ep->wMaxPacketSize;
ep_type = (enum libusb_transfer_type) (ep->bmAttributes & 0x3);
- libusb_free_config_descriptor(config);
r = val & 0x07ff;
if (ep_type == LIBUSB_TRANSFER_TYPE_ISOCHRONOUS
|| ep_type == LIBUSB_TRANSFER_TYPE_INTERRUPT)
r *= (1 + ((val >> 11) & 3));
+
+out:
+ libusb_free_config_descriptor(config);
return r;
}