summaryrefslogtreecommitdiff
path: root/usbredirhost
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-08-05 13:51:55 +0200
committerHans de Goede <hdegoede@redhat.com>2011-08-05 13:51:55 +0200
commitea56c847f4b9a1efaa6128e6e3f0e3a8b8d92bd1 (patch)
tree719b53b2250c7e0edff3bf3c1edc3c60027800bc /usbredirhost
parent1bf4c03b7c51c37fb4ae2bf52b618e813337f657 (diff)
libusbredirhost: Document libusbredirhost_open closing the handle on failure
Document that libusbredirhost_open closes the past in libusb device handle on failure, and make sure this is always true.
Diffstat (limited to 'usbredirhost')
-rw-r--r--usbredirhost/usbredirhost.c1
-rw-r--r--usbredirhost/usbredirhost.h4
2 files changed, 5 insertions, 0 deletions
diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
index 8266ceb..4c39d0c 100644
--- a/usbredirhost/usbredirhost.c
+++ b/usbredirhost/usbredirhost.c
@@ -426,6 +426,7 @@ struct usbredirhost *usbredirhost_open(
if (!host) {
log_func(func_priv, usbredirparser_error,
"usbredirhost error: Out of memory allocating usbredirhost");
+ libusb_close(usb_dev_handle);
return NULL;
}
diff --git a/usbredirhost/usbredirhost.h b/usbredirhost/usbredirhost.h
index 6759c94..691a9d3 100644
--- a/usbredirhost/usbredirhost.h
+++ b/usbredirhost/usbredirhost.h
@@ -34,6 +34,10 @@ struct usbredirhost;
read_guest_data_func / write_guest_data_func are called by the
usbredirhost to read/write data from/to the usb-guest.
+ This function returns a pointer to the created usbredirhost object on
+ success, or NULL on failure. Note that the passed in libusb_device_handle
+ is closed on failure.
+
Note:
1) Both the usbredirtransport_log and the usbredirtransport_write
callbacks may get called before this function completes.