aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/speakup
diff options
context:
space:
mode:
authorVasiliy Kulikov <segooon@gmail.com>2010-10-17 18:51:57 +0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-19 10:10:54 -0700
commitb3495cebaaa64c9e6df9ab663dfb75e86a08f9ce (patch)
tree163920dbdbd48bee38fbd2a8d0a99f5592080985 /drivers/staging/speakup
parent6a56486716d54d2c16c46cde6a5cf10062cd6719 (diff)
downloadlinaro-lsk-b3495cebaaa64c9e6df9ab663dfb75e86a08f9ce.tar.gz
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: Vasiliy Kulikov <segooon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/speakup')
-rw-r--r--drivers/staging/speakup/main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index a64704bd19b..4b7a9c2b965 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -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();