usb: gadget: udc-core: prevent a memory leak
authorFelipe Balbi <balbi@ti.com>
Tue, 2 Apr 2013 14:06:28 +0000 (17:06 +0300)
committerFelipe Balbi <balbi@ti.com>
Tue, 2 Apr 2013 14:07:06 +0000 (17:07 +0300)
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>
drivers/usb/gadget/udc-core.c

index 7999cc6..c6c2b56 100644 (file)
@@ -240,6 +240,7 @@ err3:
 
 err2:
        put_device(&gadget->dev);
+       kfree(udc);
 
 err1:
        return ret;