File tree Expand file tree Collapse file tree 3 files changed +5
-1
lines changed
Expand file tree Collapse file tree 3 files changed +5
-1
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -565,7 +565,8 @@ ufunction_t rt_usbd_function_ecm_create(udevice_t device)
565565 /* create a cdc class */
566566 cdc = rt_usbd_function_new (device , & _dev_desc , & ops );
567567 rt_usbd_device_set_qualifier (device , & dev_qualifier );
568- _ecm_eth = rt_malloc (sizeof (struct rt_ecm_eth ));
568+ _ecm_eth = rt_malloc (sizeof (struct rt_ecm_eth ));
569+ RT_ASSERT (_ecm_eth != RT_NULL );
569570 rt_memset (_ecm_eth , 0 , sizeof (struct rt_ecm_eth ));
570571 cdc -> user_data = _ecm_eth ;
571572
Original file line number Diff line number Diff line change @@ -508,6 +508,7 @@ static rt_err_t rt_usbh_hub_enable(void *arg)
508508
509509 /* create a hub instance */
510510 hub = rt_malloc (sizeof (struct uhub ));
511+ RT_ASSERT (hub != RT_NULL );
511512 rt_memset (hub , 0 , sizeof (struct uhub ));
512513
513514 /* make interface instance's user data point to hub instance */
You can’t perform that action at this time.
0 commit comments