summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/configfs.c
diff options
context:
space:
mode:
authorJohn Keeping <john@metanate.com>2017-02-28 13:55:30 +0300
committerFelipe Balbi <felipe.balbi@linux.intel.com>2017-03-06 17:45:57 +0300
commit38355b2a44776c25b0f2ad466e8c51bb805b3032 (patch)
tree245e0b77619761f6cd8a1f33a07eca27d69b8a42 /drivers/usb/gadget/configfs.c
parent5bbc852676ae08e818241cf66a3ffe4be44225c4 (diff)
downloadlinux-38355b2a44776c25b0f2ad466e8c51bb805b3032.tar.xz
usb: gadget: configs: plug memory leak
When binding a gadget to a device, "name" is stored in gi->udc_name, but this does not happen when unregistering and the string is leaked. Signed-off-by: John Keeping <john@metanate.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/gadget/configfs.c')
-rw-r--r--drivers/usb/gadget/configfs.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 78c44979dde3..cbff3b02840d 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -269,6 +269,7 @@ static ssize_t gadget_dev_desc_UDC_store(struct config_item *item,
ret = unregister_gadget(gi);
if (ret)
goto err;
+ kfree(name);
} else {
if (gi->composite.gadget_driver.udc_name) {
ret = -EBUSY;