[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1287327118-9244-1-git-send-email-segooon@gmail.com>
Date: Sun, 17 Oct 2010 18:51:57 +0400
From: Vasiliy Kulikov <segooon@...il.com>
To: kernel-janitors@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...e.de>,
William Hubbs <w.d.hubbs@...il.com>,
Samuel Thibault <samuel.thibault@...-lyon.org>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH] 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@...il.com>
---
drivers/staging/speakup/main.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 2ef3b39..b02a61f 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -2255,8 +2255,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();
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists