Commit e756bc5670d0f801ca43dc55b8eacde42a5b818b

Authored by Bjorn Helgaas
Committed by Greg Kroah-Hartman
1 parent bfc5c17337

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>

Showing 1 changed file with 1 additions and 0 deletions Side-by-side Diff

samples/kobject/kset-example.c
... ... @@ -262,6 +262,7 @@
262 262 bar_error:
263 263 destroy_foo_obj(foo_obj);
264 264 foo_error:
  265 + kset_unregister(example_kset);
265 266 return -EINVAL;
266 267 }
267 268