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

[-- Attachment #1: Type: text/plain, Size: 976 bytes --]

On Sun, 20 May 2007 22:09:37 +0200, Eric Sesterhenn / Snakebyte wrote:
> 
> 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>

Acked-by: Jörn Engel <joern@lazybastard.org>

> --- 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;
>  }
> 

Jörn

-- 
I can say that I spend most of my time fixing bugs even if I have lots
of new features to implement in mind, but I give bugs more priority.
-- Andrea Arcangeli, 2000

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-20 20:09 leak in mtd/devices/phram.c Eric Sesterhenn / Snakebyte
2007-05-20 20:49 ` Jörn Engel [this message]
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=20070520204934.GA6347@lazybastard.org \
    --to=joern@lazybastard.org \
    --cc=joern@wh.fh-wedel.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=snakebyte@gmx.de \
    /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