Re: [PATCH] usb: gadget: configs: plug memory leak

From: Suzuki K Poulose
Date: Tue Feb 28 2017 - 09:05:34 EST


On 28/02/17 10:55, John Keeping wrote:
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@xxxxxxxxxxxx>
---
drivers/usb/gadget/configfs.c | 1 +
1 file changed, 1 insertion(+)

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);

Looks correct to me.

Suzuki