diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-08-15 10:40:12 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-08-15 10:40:12 -0300 |
commit | d66d5cf09e9f237abbfe1e9da00a3ac48daec5bf (patch) | |
tree | 1b98891c1851d405500c85132a3e177c4d127c17 /linux/drivers/media/video/em28xx/em28xx-video.c | |
parent | 8c3cb543d95724a911f77d4c377ad1066557e611 (diff) | |
download | mediapointer-dvb-s2-d66d5cf09e9f237abbfe1e9da00a3ac48daec5bf.tar.gz mediapointer-dvb-s2-d66d5cf09e9f237abbfe1e9da00a3ac48daec5bf.tar.bz2 |
Fix a memory leak in em28xx_usb_probe()
From: Jesper Juhl <jesper.juhl@gmail.com>
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/em28xx/em28xx-video.c')
-rw-r--r-- | linux/drivers/media/video/em28xx/em28xx-video.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c index 21ca7809d..ed4ace009 100644 --- a/linux/drivers/media/video/em28xx/em28xx-video.c +++ b/linux/drivers/media/video/em28xx/em28xx-video.c @@ -1874,6 +1874,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; } |