[U-Boot] [PATCH v2] usb: gadget: f_thor: Free the allocated out request buffer

Michal Simek michal.simek at xilinx.com
Tue Jun 21 14:50:48 CEST 2016


From: Siva Durga Prasad Paladugu <siva.durga.paladugu at xilinx.com>

Fix the memory leak by freeing the allocated out request buffer

Signed-off-by: Siva Durga Prasad Paladugu <sivadur at xilinx.com>
Signed-off-by: Michal Simek <michal.simek at xilinx.com>
---

Changes in v2:
- Simplify logic reported by Marek

 drivers/usb/gadget/f_thor.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index a60e9487e774..cd4d9e659a39 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -891,6 +891,7 @@ static void thor_func_disable(struct usb_function *f)
 	}
 
 	if (dev->out_ep->driver_data) {
+		free(dev->out_req->buf);
 		dev->out_req->buf = NULL;
 		usb_ep_free_request(dev->out_ep, dev->out_req);
 		usb_ep_disable(dev->out_ep);
-- 
1.9.1



More information about the U-Boot mailing list