Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1589408

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

From John Keeping <john@metanate.com>
Newsgroups linux.kernel
Subject [PATCH] usb: gadget: configs: plug memory leak
Date 2017-02-28 13:40 +0100
Message-ID <tfPeq-4pW-21@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 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);
 	} else {
 		if (gi->composite.gadget_driver.udc_name) {
 			ret = -EBUSY;
-- 
2.12.0.rc2.230.ga28edc07cd.dirty

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] usb: gadget: configs: plug memory leak John Keeping <john@metanate.com> - 2017-02-28 13:40 +0100
  Re: [PATCH] usb: gadget: configs: plug memory leak Suzuki K Poulose <Suzuki.Poulose@arm.com> - 2017-02-28 15:10 +0100

csiph-web