From b3495cebaaa64c9e6df9ab663dfb75e86a08f9ce Mon Sep 17 00:00:00 2001 From: Vasiliy Kulikov Date: Sun, 17 Oct 2010 18:51:57 +0400 Subject: 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 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'drivers/staging/speakup/main.c') diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c index a64704bd19bf..4b7a9c2b965f 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(); -- cgit v1.2.3