Hello Robert, On Tue, 14 Apr 2009 15:17:16 -0400 Robert Krakora <rob.krakora@xxxxxxxxxxxxxxxxxxxxx> wrote: > em28xx: Fix for Slow Memory Leak Thanks, I am going to test and commit your patch. Cheers, Douglas > From: Robert Krakora <rob.krakora@xxxxxxxxxxxxxxxxxxxxx> > > Test Code: (Provided by Douglas) > > v4l-dvb/v4l2-apps/test/stress-buffer.c > > The audio DMA area was never being freed and would slowly leak over > time as the v4l device was opened and closed by an application. > > Thanks again to Douglas for generating the test code to help locate > memory leaks!!! > > Priority: normal > > Signed-off-by: Robert Krakora <rob.krakora@xxxxxxxxxxxxxxxxxxxxx> > > diff -r 5567e82c34a0 linux/drivers/media/video/em28xx/em28xx-audio.c > --- a/linux/drivers/media/video/em28xx/em28xx-audio.c Tue Mar 31 > 07:24:14 2009 -0300 > +++ b/linux/drivers/media/video/em28xx/em28xx-audio.c Tue Apr 14 > 10:16:45 2009 -0400 > @@ -278,6 +278,7 @@ > #endif > > dprintk("Allocating vbuffer\n"); > + > if (runtime->dma_area) { > if (runtime->dma_bytes > size) > return 0; > @@ -385,6 +386,18 @@ > mutex_lock(&dev->lock); > dev->adev.users--; > em28xx_audio_analog_set(dev); > + if (substream == dev->adev.capture_pcm_substream) > + { > + if (substream && substream->runtime && > substream->runtime->dma_area) { > + dprintk("freeing\n"); > + vfree(substream->runtime->dma_area); > + substream->runtime->dma_area = NULL; > + } > + } > + else > + { > + em28xx_errdev("substream(%p) != > dev->adev.capture_pcm_substream(%p)\n", substream, > dev->adev.capture_pcm_substream); > + } > mutex_unlock(&dev->lock); > > return 0; > -- > To unsubscribe from this list: send the line "unsubscribe > linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html