From: Pete Batard Date: Wed, 13 Jun 2012 12:38:46 +0000 (+0100) Subject: Windows: Fix erroneous pointer array allocation reported by Clang X-Git-Tag: upstream/1.0.21~622 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=67df11b691b7cdade54cbc265f9d975d46dcc10c;p=platform%2Fupstream%2Flibusb.git Windows: Fix erroneous pointer array allocation reported by Clang * Result of 'calloc' is converted to a pointer of type 'unsigned char *', which is incompatible with sizeof operand type 'PUSB_CONFIGURATION_DESCRIPTOR' * priv->config_descriptor is indeed an array of pointers, with each descriptor allocated, rather than a sequential list of fixed descriptor. --- diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index 98b26eb..461633b 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -901,7 +901,7 @@ static int cache_config_descriptors(struct libusb_device *dev, HANDLE hub_handle if (dev->num_configurations == 0) return LIBUSB_ERROR_INVALID_PARAM; - priv->config_descriptor = (unsigned char**) calloc(dev->num_configurations, sizeof(PUSB_CONFIGURATION_DESCRIPTOR)); + priv->config_descriptor = (unsigned char**) calloc(dev->num_configurations, sizeof(unsigned char*)); if (priv->config_descriptor == NULL) return LIBUSB_ERROR_NO_MEM; for (i=0; inum_configurations; i++) diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 32a4fe1..c47019a 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 10529 +#define LIBUSB_NANO 10530