[PATCH] sparc: pci: Fix memory leak in pci_bus_slot_names()

Salah Triki posted 1 patch 9 months, 4 weeks ago
There is a newer version of this series
arch/sparc/kernel/pci.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] sparc: pci: Fix memory leak in pci_bus_slot_names()
Posted by Salah Triki 9 months, 4 weeks ago
prop is a local pointer in pci_bus_slot_names(). It is initialized
by calling of_get_property() so the caller must free prop when done
using it.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 arch/sparc/kernel/pci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index ddac216a2aff..fa0da8f45723 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -971,6 +971,8 @@ static void pci_bus_slot_names(struct device_node *node, struct pci_bus *bus)
 		mask &= ~this_bit;
 		i++;
 	}
+
+	kfree(prop);
 }
 
 static int __init of_pci_slot_init(void)
-- 
2.34.1