summaryrefslogtreecommitdiff
path: root/usbredirhost
diff options
context:
space:
mode:
authorVictor Toso <victortoso@redhat.com>2020-09-17 13:51:11 +0200
committerVictor Toso <victortoso@redhat.com>2020-09-18 17:55:18 +0200
commite65f63e739b7335b11da8e1f6f68b08859140b7b (patch)
tree849e8cfdb5d9192a9e9dacf9d0be2d8aaaf8d9b9 /usbredirhost
parent985e79d5f98d5586d87204317462549332c1dd46 (diff)
usbredirhost: close device on error
In case calloc() in usbredirparser_create() fails, we should be closing libusb_device_handle* as we own it (similar is done after earlier in same function after calloc for usbredirhost*). Note that usbredirhost_close() will not work as host->handle is not set yet. Signed-off-by: Victor Toso <victortoso@redhat.com>
Diffstat (limited to 'usbredirhost')
-rw-r--r--usbredirhost/usbredirhost.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
index d55cd5c..d84ad2c 100644
--- a/usbredirhost/usbredirhost.c
+++ b/usbredirhost/usbredirhost.c
@@ -688,6 +688,7 @@ struct usbredirhost *usbredirhost_open_full(
if (!host->parser) {
log_func(func_priv, usbredirparser_error,
"usbredirhost error: Out of memory allocating usbredirparser");
+ libusb_close(usb_dev_handle);
usbredirhost_close(host);
return NULL;
}