mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vasiliy Kulikov <segooon@gmail.com>
To: kernel-janitors@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
	William Hubbs <w.d.hubbs@gmail.com>,
	Samuel Thibault <samuel.thibault@ens-lyon.org>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] staging: speakup: fix memory leak
Date: Sun, 17 Oct 2010 18:51:57 +0400	[thread overview]
Message-ID: <1287327118-9244-1-git-send-email-segooon@gmail.com> (raw)

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


                 reply	other threads:[~2010-10-17 14:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1287327118-9244-1-git-send-email-segooon@gmail.com \
    --to=segooon@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=w.d.hubbs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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