Skip to content

Commit 10e0f28

Browse files
authored
Update cdc_vcom.c
1 parent 3679dfa commit 10e0f28

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

components/drivers/usb/usbdevice/class/cdc_vcom.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ static rt_err_t _function_enable(ufunction_t func)
493493

494494
data = (struct vcom*)func->user_data;
495495
data->ep_out->buffer = rt_malloc(CDC_RX_BUFSIZE);
496+
RT_ASSERT(data->ep_out->buffer != RT_NULL);
496497

497498
data->ep_out->request.buffer = data->ep_out->buffer;
498499
data->ep_out->request.size = EP_MAXPACKET(data->ep_out);
@@ -593,6 +594,7 @@ ufunction_t rt_usbd_function_cdc_create(udevice_t device)
593594

594595
/* allocate memory for cdc vcom data */
595596
data = (struct vcom*)rt_malloc(sizeof(struct vcom));
597+
RT_ASSERT(data != RT_NULL);
596598
rt_memset(data, 0, sizeof(struct vcom));
597599
func->user_data = (void*)data;
598600

0 commit comments

Comments
 (0)