From: Felipe Balbi Date: Tue, 2 Apr 2013 14:06:28 +0000 (+0300) Subject: usb: gadget: udc-core: prevent a memory leak X-Git-Tag: firefly_0821_release~3680^2~672^2~11^2~39 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c5dbc220b327dc1ff5e0b1d829c091347511ed83;p=firefly-linux-kernel-4.4.55.git usb: gadget: udc-core: prevent a memory leak udc-core would leak 'udc' memory in some error cases. Fix it by kfree()ing udc on error path. Reported-by: Dan Carpenter Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index 7999cc656979..c6c2b5611b43 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c @@ -240,6 +240,7 @@ err3: err2: put_device(&gadget->dev); + kfree(udc); err1: return ret;