提交 e756bc56 编写于 作者: B Bjorn Helgaas 提交者: Greg Kroah-Hartman

kobject: fix kset sample error path

Previously, example_init() leaked a kset if any of the object creations
failed.  This fixes the leak by calling kset_unregister() in the error
path.
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 bfc5c173
...@@ -262,6 +262,7 @@ static int __init example_init(void) ...@@ -262,6 +262,7 @@ static int __init example_init(void)
bar_error: bar_error:
destroy_foo_obj(foo_obj); destroy_foo_obj(foo_obj);
foo_error: foo_error:
kset_unregister(example_kset);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册