[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20080622091136.GB11823@joi>
Date: Sun, 22 Jun 2008 11:11:40 +0200
From: Marcin Slusarz <marcin.slusarz@...il.com>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Daniel Marjamäki <danielm77@...ay.se>,
Mauro Carvalho Chehab <mchehab@...radead.org>,
video4linux-list@...hat.com
Subject: [PATCH] V4L/vivi: fix possible memory leak in vivi_fillbuff
Move allocation after first check and fix memory leak.
http://bugzilla.kernel.org/show_bug.cgi?id=10659
Noticed-by: Daniel Marjamäki <danielm77@...ay.se>
Signed-off-by: Marcin Slusarz <marcin.slusarz@...il.com>
Cc: Mauro Carvalho Chehab <mchehab@...radead.org>
---
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 845be18..5ff9a58 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++) {
--
1.5.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists