From: Cornelia Huck Date: Tue, 10 Apr 2007 12:35:27 +0000 (+0200) Subject: kobject: kobject_add() reference leak X-Git-Tag: v2.6.22-rc1~1119^2~27 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88db4721d47bc59b92d46de04e21c7975ea983f2;p=linux-2.6 kobject: kobject_add() reference leak We leak a reference if we attempt to add a kobject with no name. Signed-off-by: Cornelia Huck Signed-off-by: Greg Kroah-Hartman --- diff --git a/lib/kobject.c b/lib/kobject.c index db1d23707e..eb251aae78 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -174,6 +174,7 @@ int kobject_shadow_add(struct kobject * kobj, struct dentry *shadow_parent) if (!*kobj->k_name) { pr_debug("kobject attempted to be registered with no name!\n"); WARN_ON(1); + kobject_put(kobj); return -EINVAL; } parent = kobject_get(kobj->parent);