summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2008-06-22 09:11:40 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-06-26 15:58:58 -0300
commit5c554e6b984ce6b36488b93a7ec8e2752233e7cb (patch)
tree8e837cb9c858ec390207af9f1f1c489b1c35be25 /drivers
parente470d8177ed6ae56f4310ce793a57bcb2fed1749 (diff)
downloadop-kernel-dev-5c554e6b984ce6b36488b93a7ec8e2752233e7cb.zip
op-kernel-dev-5c554e6b984ce6b36488b93a7ec8e2752233e7cb.tar.gz
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')
-rw-r--r--drivers/media/video/vivi.c7
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++) {
OpenPOWER on IntegriCloud