diff --git a/examples/hello-sysfs.c b/examples/hello-sysfs.c index 7fc0e77..a86f4df 100644 --- a/examples/hello-sysfs.c +++ b/examples/hello-sysfs.c @@ -42,6 +42,7 @@ static int __init mymodule_init(void) error = sysfs_create_file(mymodule, &myvariable_attribute.attr); if (error) { + kobject_put(mymodule); pr_info("failed to create the myvariable file " "in /sys/kernel/mymodule\n"); }