USB: gadget: mtp: Fix bug in freeing memory on allocation failure
Current driver code doesn't handle the memory allocation failure correctly and ends up leaking memory and trying to free unallocated one. Change-Id: I7e3527b7e08ccfe566d85e3009d8a015d8daa707 Signed-off-by: Manu Gautam <mgautam@codeaurora.org> Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
This commit is contained in:
parent
917e41ac91
commit
fa1ac1406a
1 changed files with 1 additions and 1 deletions
|
@ -552,7 +552,7 @@ retry_rx_alloc:
|
|||
if (!req) {
|
||||
if (mtp_rx_req_len <= MTP_BULK_BUFFER_SIZE)
|
||||
goto fail;
|
||||
for (; i > 0; i--)
|
||||
for (--i; i >= 0; i--)
|
||||
mtp_request_free(dev->rx_req[i], dev->ep_out);
|
||||
mtp_rx_req_len = MTP_BULK_BUFFER_SIZE;
|
||||
goto retry_rx_alloc;
|
||||
|
|
Loading…
Add table
Reference in a new issue