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 <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
Felipe Balbi 2013-04-02 17:06:28 +03:00
parent 1cb5e9ee03
commit c5dbc220b3

View File

@ -240,6 +240,7 @@ err3:
err2:
put_device(&gadget->dev);
kfree(udc);
err1:
return ret;