From c3163714f5a104348e709c3c4210d8d60ba32532 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Fri, 25 May 2018 14:21:01 +0900 Subject: [PATCH] gadget: f_thor: Fix memory leaks of usb request and its buffer There are memory leaks of usb request and its buffer for ep0, in_ep, and out ep. Fix memory leaks of usb request and its buffer. Signed-off-by: Seung-Woo Kim [sw0312.kim: fix conflict about int_ep from thor_eps_setup()] Change-Id: I606d039d53847d0e0850c5bcbceca451bdbb1c02 --- drivers/usb/gadget/f_thor.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c index 2352416..0237750 100644 --- a/drivers/usb/gadget/f_thor.c +++ b/drivers/usb/gadget/f_thor.c @@ -998,12 +998,16 @@ static int thor_eps_setup(struct usb_function *f) result = usb_ep_enable(ep, d); if (result) - goto err; + goto err_free_out_req; ep->driver_data = cdev; /* claim */ return 0; + err_free_out_req: + usb_ep_free_request(dev->out_ep, dev->out_req); + dev->out_req = NULL; + err_disable_out_ep: usb_ep_disable(dev->out_ep); -- 2.7.4