Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c77aa044 authored by Hemant Kumar's avatar Hemant Kumar
Browse files

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: default avatarManu Gautam <mgautam@codeaurora.org>
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent 059df04a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -548,7 +548,7 @@ static int mtp_create_bulk_endpoints(struct mtp_dev *dev,
		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;