]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/vivi.c
V4L/DVB (8100): V4L/vivi: fix possible memory leak in vivi_fillbuff
[linux-2.6-omap-h63xx.git] / drivers / media / video / vivi.c
index 845be1864f685a01fad3a225bc9826ab09d61985..5ff9a58b6135b98b8644af14d042cc31cc824a5a 100644 (file)
@@ -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++) {