summaryrefslogtreecommitdiffstats
path: root/lib/libusb/libusb10.c
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2010-11-13 19:25:11 +0000
committerhselasky <hselasky@FreeBSD.org>2010-11-13 19:25:11 +0000
commit465cb0556af9e7d9eee39cb26ff5832329fa9d5f (patch)
treefc3692a2e1cc644599f47393564a242be0d4b2cd /lib/libusb/libusb10.c
parent92ec3c18bd20ab5a94f95021ea99deeeeec77f32 (diff)
downloadFreeBSD-src-465cb0556af9e7d9eee39cb26ff5832329fa9d5f.zip
FreeBSD-src-465cb0556af9e7d9eee39cb26ff5832329fa9d5f.tar.gz
Fix LibUSB v1.0 compliancy.
1) We need to allow the USB callback to free the USB transfer itself. 2) The USB transfer buffer should only be automatically freed when freeing the USB transfer. Fixed by: hselasky Submitted by: Gustau Perez i Querol Approved by: thompsa (mentor)
Diffstat (limited to 'lib/libusb/libusb10.c')
-rw-r--r--lib/libusb/libusb10.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libusb/libusb10.c b/lib/libusb/libusb10.c
index 5767cb2..3b8d567 100644
--- a/lib/libusb/libusb10.c
+++ b/lib/libusb/libusb10.c
@@ -800,6 +800,10 @@ libusb_free_transfer(struct libusb_transfer *uxfer)
if (uxfer == NULL)
return; /* be NULL safe */
+ /* check if we should free the transfer buffer */
+ if (uxfer->flags & LIBUSB_TRANSFER_FREE_BUFFER)
+ free(uxfer->buffer);
+
sxfer = (struct libusb_super_transfer *)(
(uint8_t *)uxfer - sizeof(*sxfer));
OpenPOWER on IntegriCloud