On Wed, Nov 01, 2000 at 01:42:17PM -0800, Dunlap, Randy wrote:
> > Is this bug in the usb-driver (usb-uhci), in the camera's driver
> > (cpia_usb) or in the v4l?
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Could there be a memory leak as well?  But I expect that
> it's simply that memory is just fragmented so that enough
> contiguous pages aren't available, like Rik said.

There is a memory leak, the memory kmalloc'ed in cpia_usb_open for
sbuf[*].data is never kfree'd (except when an error occurs during
initialisation). Adding some kfree's in cpia_usb_free_resources fixed
the problem in test7 or so, here's a patch against -test10.

--- drivers/media/video/cpia_usb.c.orig Wed Nov  1 14:14:37 2000
+++ drivers/media/video/cpia_usb.c      Wed Nov  1 14:16:05 2000
@@ -432,10 +432,20 @@
                ucpia->sbuf[1].urb = NULL;
        }
 
+       if (ucpia->sbuf[1].data) {
+               kfree(ucpia->sbuf[1].data);
+               ucpia->sbuf[1].data = NULL;
+       }
+ 
        if (ucpia->sbuf[0].urb) {
                usb_unlink_urb(ucpia->sbuf[0].urb);
                usb_free_urb(ucpia->sbuf[0].urb);
                ucpia->sbuf[0].urb = NULL;
+       }
+
+       if (ucpia->sbuf[0].data) {
+               kfree(ucpia->sbuf[0].data);
+               ucpia->sbuf[0].data = NULL;
        }
 }

HTH.

Cheers,
aj 

-- 
Anthony Towns <[EMAIL PROTECTED]> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. GPG signed mail preferred.

  ``We reject: kings, presidents, and voting.
                 We believe in: rough consensus and working code.''
                                      -- Dave Clark
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to