diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-06-22 09:11:40 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-06-22 09:11:40 +0000 |
commit | c7a67c1cdfedefe02daf3c0116e2622d70b31195 (patch) | |
tree | 9dbdc87afc48fe132e36905474c10e438bc36a32 | |
parent | b4f8fa702a67e27667e4d33d9e14a09f07fafa9e (diff) | |
download | mediapointer-dvb-s2-c7a67c1cdfedefe02daf3c0116e2622d70b31195.tar.gz mediapointer-dvb-s2-c7a67c1cdfedefe02daf3c0116e2622d70b31195.tar.bz2 |
V4L/vivi: fix possible memory leak in vivi_fillbuff
From: Marcin Slusarz <marcin.slusarz@gmail.com>
Move allocation after first check and fix memory leak.
Noticed-by: Daniel MarjamÀki <danielm77@spray.se>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | linux/drivers/media/video/vivi.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/linux/drivers/media/video/vivi.c b/linux/drivers/media/video/vivi.c index e367c6af9..12307d4bd 100644 --- a/linux/drivers/media/video/vivi.c +++ b/linux/drivers/media/video/vivi.c @@ -342,13 +342,14 @@ static void vivi_fillbuff(struct vivi_dev *dev, struct vivi_buffer *buf) int hmax = buf->vb.height; int wmax = buf->vb.width; struct timeval ts; - char *tmpbuf = kmalloc(wmax * 2, GFP_ATOMIC); + char *tmpbuf; void *vbuf = videobuf_to_vmalloc(&buf->vb); - if (!tmpbuf) + if (!vbuf) return; - if (!vbuf) + tmpbuf = kmalloc(wmax * 2, GFP_ATOMIC); + if (!tmpbuf) return; for (h = 0; h < hmax; h++) { |