Merge pull request #1179 from uestczyh222/master

[Components][Drivers][USB]fix memory leak
This commit is contained in:
Bernard Xiong 2018-01-18 06:38:24 +08:00 committed by GitHub
commit 0d7a74cc3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -486,7 +486,10 @@ static rt_err_t _function_enable(ufunction_t func)
// //
// _vcom_reset_state(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.buffer = data->ep_out->buffer;
data->ep_out->request.size = EP_MAXPACKET(data->ep_out); data->ep_out->request.size = EP_MAXPACKET(data->ep_out);
data->ep_out->request.req_type = UIO_REQUEST_READ_BEST; data->ep_out->request.req_type = UIO_REQUEST_READ_BEST;