* [PATCH] staging: speakup: fix memory leak
@ 2010-10-17 14:51 Vasiliy Kulikov
0 siblings, 0 replies; only message in thread
From: Vasiliy Kulikov @ 2010-10-17 14:51 UTC (permalink / raw)
To: kernel-janitors
Cc: Greg Kroah-Hartman, William Hubbs, Samuel Thibault, devel, linux-kernel
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>
---
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-10-17 14:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-17 14:51 [PATCH] staging: speakup: fix memory leak Vasiliy Kulikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome