public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Eric Sesterhenn / Snakebyte <snakebyte@gmx.de>
To: joern@wh.fh-wedel.de
Cc: linux-mtd@lists.infradead.org
Subject: leak in mtd/devices/phram.c
Date: Sun, 20 May 2007 22:09:37 +0200	[thread overview]
Message-ID: <20070520200936.GB22049@alice> (raw)

hi,

coverity spotted this leak in mtd/devices/phram.c (bug id #1512),
when register_device() fails, we dont kfree() name and leak it,
attached patch should fix this.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>


--- linux-2.6/drivers/mtd/devices/phram.c.orig	2007-05-20 22:04:24.000000000 +0200
+++ linux-2.6/drivers/mtd/devices/phram.c	2007-05-20 22:06:12.000000000 +0200
@@ -276,7 +276,9 @@ static int phram_setup(const char *val, 
 		parse_err("illegal device length\n");
 	}
 
-	register_device(name, start, len);
+	ret = register_device(name, start, len);
+	if (ret)
+		kfree(name);
 
 	return 0;
 }

             reply	other threads:[~2007-05-20 20:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-20 20:09 Eric Sesterhenn / Snakebyte [this message]
2007-05-20 20:49 ` leak in mtd/devices/phram.c Jörn Engel
2007-05-22  7:46 ` MikeW

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=20070520200936.GB22049@alice \
    --to=snakebyte@gmx.de \
    --cc=joern@wh.fh-wedel.de \
    --cc=linux-mtd@lists.infradead.org \
    /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