linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [media] cx231xx: Fix memory leak
@ 2016-01-08 21:10 Jean-Baptiste Theou
  2016-01-08 21:55 ` kbuild test robot
  2016-01-08 22:02 ` [PATCH v2] " Jean-Baptiste Theou
  0 siblings, 2 replies; 3+ messages in thread
From: Jean-Baptiste Theou @ 2016-01-08 21:10 UTC (permalink / raw)
  To: linux-media; +Cc: Jean-Baptiste Theou

dma_area needs to be freed when the device is close.

Based on em23xx-audio.c

Signed-off-by: Jean-Baptiste Theou <jtheou@adeneo-embedded.us>
---
 drivers/media/usb/cx231xx/cx231xx-audio.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c b/drivers/media/usb/cx231xx/cx231xx-audio.c
index de4ae5e..2f3d7df 100644
--- a/drivers/media/usb/cx231xx/cx231xx-audio.c
+++ b/drivers/media/usb/cx231xx/cx231xx-audio.c
@@ -499,6 +499,11 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream)
 	}
 
 	dev->adev.users--;
+	if (substream->runtime->dma_area) {
+		dprintk("freeing\n");
+		vfree(substream->runtime->dma_area);
+		substream->runtime->dma_area = NULL;
+	}
 	mutex_unlock(&dev->lock);
 
 	if (dev->adev.users == 0 && dev->adev.shutdown == 1) {
-- 
2.6.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-08 22:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-08 21:10 [PATCH] [media] cx231xx: Fix memory leak Jean-Baptiste Theou
2016-01-08 21:55 ` kbuild test robot
2016-01-08 22:02 ` [PATCH v2] " Jean-Baptiste Theou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).