fixme review
review functionality missing over 0.1
endianness of control setup, issues when resubmitting transfers
-interpreting transfer flags after callback returns is not safe
rename poll to handle_events
make libusb_get_pollfds return const?
doxygen warnings
enum libusb_transfer_status status)
{
struct libusb_transfer *transfer = &itransfer->pub;
+ uint8_t flags;
if (status == LIBUSB_TRANSFER_SILENT_COMPLETION)
return;
}
}
+ flags = transfer->flags;
transfer->status = status;
transfer->actual_length = itransfer->transferred;
if (transfer->callback)
transfer->callback(transfer);
- if (transfer->flags & LIBUSB_TRANSFER_FREE_TRANSFER)
+ /* transfer might have been freed by the above call, do not use from
+ * this point. */
+ if (flags & LIBUSB_TRANSFER_FREE_TRANSFER)
libusb_free_transfer(transfer);
}
/** Automatically free() transfer buffer during libusb_free_transfer() */
LIBUSB_TRANSFER_FREE_BUFFER = 1<<1,
- /** Automatically call libusb_free_transfer() after callback returns */
+ /** Automatically call libusb_free_transfer() after callback returns.
+ * If this flag is set, it is illegal to call libusb_free_transfer()
+ * from your transfer callback, as this will result in a double-free
+ * when this flag is acted upon. */
LIBUSB_TRANSFER_FREE_TRANSFER = 1<<2,
};