[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1287327114-9201-1-git-send-email-segooon@gmail.com>
Date: Sun, 17 Oct 2010 18:51:53 +0400
From: Vasiliy Kulikov <segooon@...il.com>
To: kernel-janitors@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...e.de>,
William Hubbs <w.d.hubbs@...il.com>,
Samuel Thibault <samuel.thibault@...-lyon.org>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH] staging: speakup: fix leaks of sysfs groups
speakup_kobj_init() and speakup_kobj_exit() didn't remove
i18n_attr_group and main_attr_group sysfs groups.
Signed-off-by: Vasiliy Kulikov <segooon@...il.com>
---
drivers/staging/speakup/kobjects.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index e12b0e7..cc79f9e 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -989,24 +989,34 @@ int speakup_kobj_init(void)
speakup_kobj = kobject_create_and_add("speakup", accessibility_kobj);
if (!speakup_kobj) {
- kobject_put(accessibility_kobj);
- return -ENOMEM;
+ retval = -ENOMEM;
+ goto err_acc;
}
/* Create the files associated with this kobject */
retval = sysfs_create_group(speakup_kobj, &main_attr_group);
if (retval)
- speakup_kobj_exit();
+ goto err_speakup;
retval = sysfs_create_group(speakup_kobj, &i18n_attr_group);
if (retval)
- speakup_kobj_exit();
+ goto err_group;
+
+ return 0;
+err_group:
+ sysfs_remove_group(speakup_kobj, &main_attr_group);
+err_speakup:
+ kobject_put(speakup_kobj);
+err_acc:
+ kobject_put(accessibility_kobj);
return retval;
}
void speakup_kobj_exit(void)
{
+ sysfs_remove_group(speakup_kobj, &i18n_attr_group);
+ sysfs_remove_group(speakup_kobj, &main_attr_group);
kobject_put(speakup_kobj);
kobject_put(accessibility_kobj);
}
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists