提交 5c554e6b 编写于 作者: M Marcin Slusarz 提交者: Mauro Carvalho Chehab

V4L/DVB (8100): V4L/vivi: fix possible memory leak in vivi_fillbuff

Move allocation after first check and fix memory leak.
Noticed-by: NDaniel Marjamäki <danielm77@spray.se>
Signed-off-by: NMarcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@infradead.org>
上级 e470d817
......@@ -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++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册