From: Patrick Pannuto on
This leak is the same as the bus path; cp's kobj name
is set, but kset_register fails, free'ing cp, but not

Signed-off-by: Patrick Pannuto <ppannuto(a)>
drivers/base/class.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/base/class.c b/drivers/base/class.c
index 8e231d0..045acaf 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -197,6 +197,7 @@ int __class_register(struct class *cls, struct lock_class_key *key)

error = kset_register(&cp->class_subsys);
if (error) {
+ kfree(cp->;
return error;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)
More majordomo info at
Please read the FAQ at