aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@gmail.com>2006-11-25 14:09:30 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-11-25 16:28:33 -0500
commit82189b9807e05ea8d1f69de5bf92eaf244a0eb12 (patch)
treeecc6f1cf933a249ea1a9a9858a7a90878ec4162b /drivers/base/core.c
parent533221fbaf001692d5db646f84f7d033fac78cc7 (diff)
[PATCH] Fix device_attribute memory leak in device_del
dev->devt_attr is allocated in device_add() but it is never freed in device_del() in the drivers/base/core.c file (reported by kmemleak). Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com> Acked-by: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r--drivers/base/core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 68ad11af22b4..002fde46d38d 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -591,8 +591,10 @@ void device_del(struct device * dev)
591 591
592 if (parent) 592 if (parent)
593 klist_del(&dev->knode_parent); 593 klist_del(&dev->knode_parent);
594 if (dev->devt_attr) 594 if (dev->devt_attr) {
595 device_remove_file(dev, dev->devt_attr); 595 device_remove_file(dev, dev->devt_attr);
596 kfree(dev->devt_attr);
597 }
596 if (dev->class) { 598 if (dev->class) {
597 sysfs_remove_link(&dev->kobj, "subsystem"); 599 sysfs_remove_link(&dev->kobj, "subsystem");
598 sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id); 600 sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id);