Skip to content

Commit

Permalink
usb: gadget: udc-core: prevent a memory leak
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Felipe Balbi committed Apr 2, 2013
1 parent 1cb5e9e commit c5dbc22
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/usb/gadget/udc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,

err2:
put_device(&gadget->dev);
kfree(udc);

err1:
return ret;
Expand Down

0 comments on commit c5dbc22

Please sign in to comment.