[winusb.c] add checking after allocating memory for variable winusb_device to make sure allocae is successful
This commit is contained in:
parent
a8b7e28741
commit
085ded8eef
|
@ -324,6 +324,8 @@ ufunction_t rt_usbd_function_winusb_create(udevice_t device)
|
|||
|
||||
/* allocate memory for cdc vcom data */
|
||||
winusb_device = (winusb_device_t)rt_malloc(sizeof(struct winusb_device));
|
||||
if (winusb_device == NULL)
|
||||
return RT_NULL;
|
||||
rt_memset((void *)winusb_device, 0, sizeof(struct winusb_device));
|
||||
func->user_data = (void*)winusb_device;
|
||||
/* create an interface object */
|
||||
|
|
Loading…
Reference in New Issue