Skip to content

Commit

Permalink
V4L/DVB (8100): V4L/vivi: fix possible memory leak in vivi_fillbuff
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marcin Slusarz authored and Mauro Carvalho Chehab committed Jun 26, 2008
1 parent e470d81 commit 5c554e6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/media/video/vivi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 5c554e6

Please sign in to comment.