Skip to content

Commit

Permalink
kobject: fix kset sample error path
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
bjorn-helgaas authored and gregkh committed Dec 3, 2013
1 parent bfc5c17 commit e756bc5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions samples/kobject/kset-example.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ static int __init example_init(void)
bar_error:
destroy_foo_obj(foo_obj);
foo_error:
kset_unregister(example_kset);
return -EINVAL;
}

Expand Down

0 comments on commit e756bc5

Please sign in to comment.