linux_usbfs: Avoid file descriptor leak in error case

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
This commit is contained in:
Chris Dickens 2015-09-17 22:27:21 -07:00
parent 377f513da1
commit 3dbf0a9c5e
2 changed files with 6 additions and 2 deletions

View file

@ -1320,7 +1320,11 @@ static int op_open(struct libusb_device_handle *handle)
hpriv->caps |= USBFS_CAP_BULK_CONTINUATION; hpriv->caps |= USBFS_CAP_BULK_CONTINUATION;
} }
return usbi_add_pollfd(HANDLE_CTX(handle), hpriv->fd, POLLOUT); r = usbi_add_pollfd(HANDLE_CTX(handle), hpriv->fd, POLLOUT);
if (r < 0)
close(hpriv->fd);
return r;
} }
static void op_close(struct libusb_device_handle *dev_handle) static void op_close(struct libusb_device_handle *dev_handle)

View file

@ -1 +1 @@
#define LIBUSB_NANO 11008 #define LIBUSB_NANO 11009