Browse Source

Update cdc_vcom.c

David Lin 5 years ago
parent
commit
10e0f28754
1 changed files with 2 additions and 0 deletions
  1. 2 0
      components/drivers/usb/usbdevice/class/cdc_vcom.c

+ 2 - 0
components/drivers/usb/usbdevice/class/cdc_vcom.c

@@ -493,6 +493,7 @@ static rt_err_t _function_enable(ufunction_t func)
     
     data = (struct vcom*)func->user_data;
     data->ep_out->buffer = rt_malloc(CDC_RX_BUFSIZE);
+    RT_ASSERT(data->ep_out->buffer != RT_NULL);
 
     data->ep_out->request.buffer = data->ep_out->buffer;
     data->ep_out->request.size = EP_MAXPACKET(data->ep_out);
@@ -593,6 +594,7 @@ ufunction_t rt_usbd_function_cdc_create(udevice_t device)
     
     /* allocate memory for cdc vcom data */
     data = (struct vcom*)rt_malloc(sizeof(struct vcom));
+    RT_ASSERT(data != RT_NULL);
     rt_memset(data, 0, sizeof(struct vcom));
     func->user_data = (void*)data;