未验证 提交 3cf07f1a 编写于 作者: K kkangdom 提交者: GitHub

[components][rndis.c] add a checkout procedure after malloc to make sure...

[components][rndis.c] add a checkout procedure after malloc to make sure allocating successfully (#7460)
上级 4ce116da
......@@ -1331,6 +1331,13 @@ ufunction_t rt_usbd_function_rndis_create(udevice_t device)
cdc = rt_usbd_function_new(device, &_dev_desc, &ops);
rt_usbd_device_set_qualifier(device, &dev_qualifier);
_rndis= rt_malloc(sizeof(struct rt_rndis_eth));
if(_rndis == RT_NULL)
{
LOG_E("%s,%d: no memory!", __func__, __LINE__);
return RT_NULL;
}
rt_memset(_rndis, 0, sizeof(struct rt_rndis_eth));
cdc->user_data = _rndis;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册