aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJesper Juhl <jesper.juhl@gmail.com>2007-08-09 17:02:36 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-08-22 17:27:47 -0400
commit1207cf84f289694ba7ba8eeaa346a0195b3de606 (patch)
tree61fd07daf4a4cf43b15f594637fb7214c5b5f9c7 /drivers/media
parente48eb085aca2971a1249efbb68f33e9ebca1395e (diff)
USB: Fix a memory leak in em28xx_usb_probe()
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: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c1
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 2c7b158ce7e1..40307f3f6fe3 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,
1772 if (dev->alt_max_pkt_size == NULL) { 1772 if (dev->alt_max_pkt_size == NULL) {
1773 em28xx_errdev("out of memory!\n"); 1773 em28xx_errdev("out of memory!\n");
1774 em28xx_devused&=~(1<<nr); 1774 em28xx_devused&=~(1<<nr);
1775 kfree(dev);
1775 return -ENOMEM; 1776 return -ENOMEM;
1776 } 1777 }
1777 1778