Replaced malloc in urbdrc channel
This commit is contained in:
parent
804891c0e8
commit
bc7d423c6c
@ -457,8 +457,10 @@ static LIBUSB_DEVICE* udev_get_libusb_dev(libusb_context* context, uint8_t bus_n
|
||||
static LIBUSB_DEVICE_DESCRIPTOR* udev_new_descript(URBDRC_PLUGIN* urbdrc, LIBUSB_DEVICE* libusb_dev)
|
||||
{
|
||||
int ret;
|
||||
LIBUSB_DEVICE_DESCRIPTOR* descriptor;
|
||||
descriptor = (LIBUSB_DEVICE_DESCRIPTOR*)malloc(sizeof(LIBUSB_DEVICE_DESCRIPTOR));
|
||||
LIBUSB_DEVICE_DESCRIPTOR* descriptor =
|
||||
(LIBUSB_DEVICE_DESCRIPTOR*)calloc(1, sizeof(LIBUSB_DEVICE_DESCRIPTOR));
|
||||
if (!descriptor)
|
||||
return NULL;
|
||||
ret = libusb_get_device_descriptor(libusb_dev, descriptor);
|
||||
|
||||
if (log_libusb_result(urbdrc->log, WLOG_ERROR, "libusb_get_device_descriptor", ret))
|
||||
|
@ -665,7 +665,7 @@ static BOOL urbdrc_udevman_register_devices(UDEVMAN* udevman, const char* device
|
||||
}
|
||||
else
|
||||
{
|
||||
idpair = malloc(sizeof(VID_PID_PAIR));
|
||||
idpair = calloc(1, sizeof(VID_PID_PAIR));
|
||||
if (!idpair)
|
||||
return CHANNEL_RC_NO_MEMORY;
|
||||
idpair->vid = id1;
|
||||
|
Loading…
Reference in New Issue
Block a user