usb: gadget: eliminate memory leak in slp gadget
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Thu, 23 Jan 2014 10:18:36 +0000 (11:18 +0100)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:46:55 +0000 (11:46 +0900)
Free the allocated acm_function_config struct in case of error.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Change-Id: Ie935cf67beccc2071d1ecd74437cffbe6a6827b8

drivers/usb/gadget/slp.c

index 3ca9202..70b7d2f 100644 (file)
@@ -282,6 +282,8 @@ err_usb_get_function_instance:
 err_usb_get_function:
                usb_put_function_instance(config->f_acm_inst[i]);
        }
+       kfree(f->config);
+       f->config = NULL;
        return ret;
 }