diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2008-06-22 09:11:40 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-06-26 15:58:58 -0300 |
commit | 5c554e6b984ce6b36488b93a7ec8e2752233e7cb (patch) | |
tree | 8e837cb9c858ec390207af9f1f1c489b1c35be25 /drivers/media/video/vivi.c | |
parent | e470d8177ed6ae56f4310ce793a57bcb2fed1749 (diff) | |
download | talos-op-linux-5c554e6b984ce6b36488b93a7ec8e2752233e7cb.tar.gz talos-op-linux-5c554e6b984ce6b36488b93a7ec8e2752233e7cb.zip |
V4L/DVB (8100): V4L/vivi: fix possible memory leak in vivi_fillbuff
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>
Diffstat (limited to 'drivers/media/video/vivi.c')
-rw-r--r-- | drivers/media/video/vivi.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 845be1864f68..5ff9a58b6135 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -327,13 +327,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++) { |