diff options
author | Chris Dickens <christopher.a.dickens@gmail.com> | 2015-09-20 15:24:05 -0700 |
---|---|---|
committer | Chris Dickens <christopher.a.dickens@gmail.com> | 2015-09-20 15:24:05 -0700 |
commit | 4a0eacbc6f4268c29c1c8d13a89aa42f689bb91c (patch) | |
tree | a776c5b7f91a869a02a425f7ec35a3e6882ae53f /libusb | |
parent | a7e946aa1dcf51cfdada5732938e5d1ca18c749f (diff) | |
download | libusb-4a0eacbc6f4268c29c1c8d13a89aa42f689bb91c.tar.gz |
Windows: Fix potential memory leak
The windows_assign_endpoints() function does not free the config
descriptor before returning in two cases.
Issue reported by dmitrykos <dmitrykos@neutroncode.com>
Closes #98
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'libusb')
-rw-r--r-- | libusb/os/windows_usb.c | 2 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index 79a9612..c92792c 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -708,11 +708,13 @@ static int windows_assign_endpoints(struct libusb_device_handle *dev_handle, int if (if_desc->bNumEndpoints == 0) { usbi_dbg("no endpoints found for interface %d", iface); + libusb_free_config_descriptor(conf_desc); return LIBUSB_SUCCESS; } priv->usb_interface[iface].endpoint = (uint8_t*) malloc(if_desc->bNumEndpoints); if (priv->usb_interface[iface].endpoint == NULL) { + libusb_free_config_descriptor(conf_desc); return LIBUSB_ERROR_NO_MEM; } diff --git a/libusb/version_nano.h b/libusb/version_nano.h index fbc4185..117d1f6 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11011 +#define LIBUSB_NANO 11012 |