Skip to content

Commit e756bc5

Browse files
bjorn-helgaasgregkh
authored andcommitted
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>
1 parent bfc5c17 commit e756bc5

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎samples/kobject/kset-example.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ static int __init example_init(void)
262262
bar_error:
263263
destroy_foo_obj(foo_obj);
264264
foo_error:
265+
kset_unregister(example_kset);
265266
return -EINVAL;
266267
}
267268

0 commit comments

Comments
 (0)