Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Bjorn Helgaas and committed by
Greg Kroah-Hartman
e756bc56 bfc5c173

+1
+1
samples/kobject/kset-example.c
··· 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