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 7999cc656979a5f8a7bab69368a3c8f09b950b5b..c6c2b5611b4308ae296b55f6f746a04d107737af 100644 (file)
@@ -240,6 +240,7 @@ err3:
 
 err2:
        put_device(&gadget->dev);
+       kfree(udc);
 
 err1:
        return ret;