From 75c74d1c78ec3b713a986e0efc645ed558384cdf Mon Sep 17 00:00:00 2001 From: Robert Krakora Date: Thu, 28 May 2009 11:16:19 -0300 Subject: [PATCH] V4L/DVB (11896): em28xx: Fix for Slow Memory Leak 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!!! Signed-off-by: Robert Krakora Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-audio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index 0131322475bf..7bd8a70f0a0b 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c @@ -339,6 +339,11 @@ static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream) mutex_lock(&dev->lock); dev->adev.users--; em28xx_audio_analog_set(dev); + if (substream->runtime->dma_area) { + dprintk("freeing\n"); + vfree(substream->runtime->dma_area); + substream->runtime->dma_area = NULL; + } mutex_unlock(&dev->lock); return 0; -- 2.34.1