Explorar o código

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>
Bjorn Helgaas %!s(int64=12) %!d(string=hai) anos
pai
achega
e756bc5670
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      samples/kobject/kset-example.c

+ 1 - 0
samples/kobject/kset-example.c

@@ -262,6 +262,7 @@ baz_error:
 bar_error:
 	destroy_foo_obj(foo_obj);
 foo_error:
+	kset_unregister(example_kset);
 	return -EINVAL;
 }