[patch 72/83] PCI: stop leaking slot_name in pci_create_slot

Greg KH
2008-12-11T19:44:05Z

[-- Attachment #1: pci-stop-leaking-slot_name-in-pci_create_slot.patch --]
[-- Type: text/plain, Size: 834 bytes --]

2.6.27-stable review patch. If anyone has any objections, please let us know.

------------------

From: Alex Chiang <achiang@hp.com>

commit 3b5dd45e947ecd21491e1658fba7bb4bc4a54995 upstream.

In pci_create_slot(), the local variable 'slot_name' is allocated by
make_slot_name(), but never freed. We never use it after passing it to
the kobject core, so we should free it upon function exit.

Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
drivers/pci/slot.c | 1 +
1 file changed, 1 insertion(+)

--- a/drivers/pci/slot.c
+++ b/drivers/pci/slot.c
@@ -243,6 +243,7 @@ placeholder:
__func__, pci_domain_nr(parent), parent->number, slot_nr);

out:
+ kfree(slot_name);
up_write(&pci_bus_sem);
return slot;