diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-11-18 11:23:19 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-11-18 11:23:19 -0200 |
commit | a370946d785e65e0ded57703e7e4981631ad9012 (patch) | |
tree | 5e4dfc5dc1fbac87adbaacd26d7c5492f08ff12f /linux/drivers | |
parent | ff8653be50368f7997308c7834fbb41d771132cc (diff) | |
download | mediapointer-dvb-s2-a370946d785e65e0ded57703e7e4981631ad9012.tar.gz mediapointer-dvb-s2-a370946d785e65e0ded57703e7e4981631ad9012.tar.bz2 |
em28xx: Avoid memory leaks if registration fails
From: Mauro Carvalho Chehab <mchehab@redhat.com>
em28xx_init_dev() has some error conditions that are not properly
de-allocating dev var, nor freeing the device number for a future usage.
Priority: high
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux/drivers')
-rw-r--r-- | linux/drivers/media/video/em28xx/em28xx-video.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c index 09886d567..625c9dea1 100644 --- a/linux/drivers/media/video/em28xx/em28xx-video.c +++ b/linux/drivers/media/video/em28xx/em28xx-video.c @@ -2034,8 +2034,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, errCode = em28xx_config(dev); if (errCode) { em28xx_errdev("error configuring device\n"); - em28xx_devused &= ~(1<<dev->devno); - kfree(dev); return -ENOMEM; } @@ -2172,7 +2170,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, fail_unreg: em28xx_release_resources(dev); mutex_unlock(&dev->lock); - kfree(dev); return retval; } @@ -2333,8 +2330,12 @@ static int em28xx_usb_probe(struct usb_interface *interface, /* allocate device struct */ retval = em28xx_init_dev(&dev, udev, nr); - if (retval) + if (retval) { + em28xx_devused &= ~(1<<dev->devno); + kfree(dev); + return retval; + } em28xx_info("Found %s\n", em28xx_boards[dev->model].name); |