mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
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: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
bfc5c17337
commit
e756bc5670
1 changed files with 1 additions and 0 deletions
|
@ -262,6 +262,7 @@ baz_error:
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue