提交 a9f18214 编写于 作者: lymzzyh's avatar lymzzyh

[Components][Drivers][USB]fix memory leak

修复一个 bug 该bug曾导致在设备不断电但主机重新枚举设备的情况下会导致内存泄漏并无法接收数据
上级 627a90c2
......@@ -486,7 +486,10 @@ static rt_err_t _function_enable(ufunction_t func)
//
// _vcom_reset_state(func);
//
data->ep_out->buffer = rt_malloc(HID_RX_BUFSIZE);
if(data->ep_out->buffer == RT_NULL)
{
data->ep_out->buffer = rt_malloc(HID_RX_BUFSIZE);
}
data->ep_out->request.buffer = data->ep_out->buffer;
data->ep_out->request.size = EP_MAXPACKET(data->ep_out);
data->ep_out->request.req_type = UIO_REQUEST_READ_BEST;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册