diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2013-10-08 16:20:24 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-12-03 13:13:30 -0500 |
commit | e756bc5670d0f801ca43dc55b8eacde42a5b818b (patch) | |
tree | 0dc1d44a9b3c41e48c5e0689255db28f855301d3 /samples | |
parent | bfc5c17337145955b31c22b96a6e07def048471b (diff) |
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>
Diffstat (limited to 'samples')
-rw-r--r-- | samples/kobject/kset-example.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/samples/kobject/kset-example.c b/samples/kobject/kset-example.c index d0c687fd9802..5dce351f131f 100644 --- a/samples/kobject/kset-example.c +++ b/samples/kobject/kset-example.c | |||
@@ -262,6 +262,7 @@ baz_error: | |||
262 | bar_error: | 262 | bar_error: |
263 | destroy_foo_obj(foo_obj); | 263 | destroy_foo_obj(foo_obj); |
264 | foo_error: | 264 | foo_error: |
265 | kset_unregister(example_kset); | ||
265 | return -EINVAL; | 266 | return -EINVAL; |
266 | } | 267 | } |
267 | 268 | ||