Skip to contentSkip to conversation

slub: sysfs_slab_remove should free kmem_cache when debug is enabled

PATCH Applied Xiaotian Feng 3 participants 3 messages Jul 22, 2009 – Jul 23, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 slub: sysfs_slab_remove should free kmem_cache when debug is enabled

kmem_cache_destroy use sysfs_slab_remove to release the kmem_cache, but when CONFIG_SLUB_DEBUG is enabled, sysfs_slab_remove just release related kobject, the whole kmem_cache is missed to release and cause a memory leak.

---
 mm/slub.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
mm/slub.c +1 -0
index b9f1491..05b69fd 100644
@@ -4559,6 +4559,7 @@ static void sysfs_slab_remove(struct kmem_cache *s)
 	kobject_uevent(&s->kobj, KOBJ_REMOVE);
 	kobject_del(&s->kobj);
 	kobject_put(&s->kobj);
+	kfree(s);
 }
 
 /*
Signature · 7 lines
1.6.2.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>