mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Markus Rechberger" <mrechberger@gmail.com>
To: "Jesper Juhl" <jesper.juhl@gmail.com>
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Luca Risolia" <luca.risolia@studio.unibo.it>,
	"Ludovico Cavedon" <cavedon@sssup.it>,
	"Mauro Carvalho Chehab" <mchehab@infradead.org>,
	"Sascha Sommer" <saschasommer@freenet.de>,
	"Greg Kroah-Hartman" <greg@kroah.com>
Subject: Re: [PATCH] Fix a memory leak in em28xx_usb_probe()
Date: Wed, 15 Aug 2007 21:49:13 +0200	[thread overview]
Message-ID: <d9def9db0708151249s6cbd7e51haf94c53efb539dc0@mail.gmail.com> (raw)
In-Reply-To: <200708092302.36705.jesper.juhl@gmail.com>

Hi Jesper,

On 8/9/07, Jesper Juhl <jesper.juhl@gmail.com> wrote:
> EHLO,
>
> If, in em28xx_usb_probe() the memory allocation
> 	dev->alt_max_pkt_size = kmalloc(32*
> 						dev->num_alt,GFP_KERNEL);
> fails, then we'll bail out and return -ENOMEM.
> The problem is that in that case we don't free the storage allocated
> to 'dev', thus causing a memory leak.
>
> This patch fixes the leak by freeing 'dev' before we return -ENOMEM.
> This fixes Coverity bug #647.
>
>
> Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>

Acked-by: Markus Rechberger <mrechberger@gmail.com>

thanks,
Markus

> ---
>
>  drivers/media/video/em28xx/em28xx-video.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/media/video/em28xx/em28xx-video.c
> b/drivers/media/video/em28xx/em28xx-video.c
> index 2c7b158..40307f3 100644
> --- a/drivers/media/video/em28xx/em28xx-video.c
> +++ b/drivers/media/video/em28xx/em28xx-video.c
> @@ -1772,6 +1772,7 @@ static int em28xx_usb_probe(struct usb_interface
> *interface,
>  	if (dev->alt_max_pkt_size == NULL) {
>  		em28xx_errdev("out of memory!\n");
>  		em28xx_devused&=~(1<<nr);
> +		kfree(dev);
>  		return -ENOMEM;
>  	}
>
>
>
>
>


-- 
Markus Rechberger

      reply	other threads:[~2007-08-15 19:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-09 21:02 Jesper Juhl
2007-08-15 19:49 ` Markus Rechberger [this message]

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=d9def9db0708151249s6cbd7e51haf94c53efb539dc0@mail.gmail.com \
    --to=mrechberger@gmail.com \
    --cc=cavedon@sssup.it \
    --cc=greg@kroah.com \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.risolia@studio.unibo.it \
    --cc=mchehab@infradead.org \
    --cc=saschasommer@freenet.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

all inboxes | Powered by JetHome®