summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-04-14 15:50:33 -0700
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-04-14 15:50:33 -0700
commit138c81cd1bac037cd7a973fa84e915e0c3ecc59a (patch)
treefefd3ca7f14ff2f571a165ae054edd40eee07ff5 /linux/drivers
parent635283a5dcc470c8dc22d6cabaf1eac4e3e08bf4 (diff)
downloadmediapointer-dvb-s2-138c81cd1bac037cd7a973fa84e915e0c3ecc59a.tar.gz
mediapointer-dvb-s2-138c81cd1bac037cd7a973fa84e915e0c3ecc59a.tar.bz2
drivers/media/video/saa5249.c: fix use-after-free and leak
From: Dan Carpenter <error27@gmail.com> I moved the kfree() down a couple lines. t->vdev is going to be in freed memory so there is no point setting it to NULL. I added a kfree(t) on a different error path. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/video/saa5249.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/linux/drivers/media/video/saa5249.c b/linux/drivers/media/video/saa5249.c
index e5643b2b6..2d9d7d7fd 100644
--- a/linux/drivers/media/video/saa5249.c
+++ b/linux/drivers/media/video/saa5249.c
@@ -604,6 +604,7 @@ static int saa5249_probe(struct i2c_client *client,
/* Now create a video4linux device */
t->vdev = video_device_alloc();
if (t->vdev == NULL) {
+ kfree(t);
kfree(client);
return -ENOMEM;
}
@@ -623,9 +624,8 @@ static int saa5249_probe(struct i2c_client *client,
/* Register it */
err = video_register_device(t->vdev, VFL_TYPE_VTX, -1);
if (err < 0) {
- kfree(t);
video_device_release(t->vdev);
- t->vdev = NULL;
+ kfree(t);
return err;
}
return 0;