Skip to content

Commit

Permalink
staging: speakup: fix memory leak
Browse files Browse the repository at this point in the history
speakup_init() didn't free first_console if speakup_kobj_init() fails.
Also propagate speakup_kobj_init()'s return code.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Vasiliy Kulikov authored and Greg Kroah-Hartman committed Oct 19, 2010
1 parent 6a56486 commit b3495ce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/staging/speakup/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2259,8 +2259,11 @@ static int __init speakup_init(void)
first_console = kzalloc(sizeof(*first_console), GFP_KERNEL);
if (!first_console)
return -ENOMEM;
if (speakup_kobj_init() < 0)
return -ENOMEM;
err = speakup_kobj_init();
if (err) {
kfree(first_console);
return err;
}

reset_default_chars();
reset_default_chartab();
Expand Down

0 comments on commit b3495ce

Please sign in to comment.