Commit b3495ceb authored by Vasiliy Kulikov's avatar Vasiliy Kulikov Committed by Greg Kroah-Hartman

staging: speakup: fix memory leak

speakup_init() didn't free first_console if speakup_kobj_init() fails.
Also propagate speakup_kobj_init()'s return code.
Signed-off-by: default avatarVasiliy Kulikov <segooon@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6a564867
...@@ -2259,8 +2259,11 @@ static int __init speakup_init(void) ...@@ -2259,8 +2259,11 @@ static int __init speakup_init(void)
first_console = kzalloc(sizeof(*first_console), GFP_KERNEL); first_console = kzalloc(sizeof(*first_console), GFP_KERNEL);
if (!first_console) if (!first_console)
return -ENOMEM; return -ENOMEM;
if (speakup_kobj_init() < 0) err = speakup_kobj_init();
return -ENOMEM; if (err) {
kfree(first_console);
return err;
}
reset_default_chars(); reset_default_chars();
reset_default_chartab(); reset_default_chartab();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment