summaryrefslogtreecommitdiff
path: root/drivers/media/usb/cx231xx/cx231xx-audio.c
diff options
context:
space:
mode:
authorJean-Baptiste Theou <jtheou@adeneo-embedded.us>2016-01-08 20:02:03 -0200
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-02-01 08:00:47 -0200
commit9dd73448c6a98b1971e626627e4b020b8898a3f6 (patch)
tree7776bc1d34e1ef80d7d048e739b04247a6da06f0 /drivers/media/usb/cx231xx/cx231xx-audio.c
parentaeae69daa312246e8f03ed2f6bc792d25a531118 (diff)
[media] cx231xx: Fix memory leak
dma_area needs to be freed when the device is closed. Based on em23xx-audio.c Signed-off-by: Jean-Baptiste Theou <jtheou@adeneo-embedded.us> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/cx231xx/cx231xx-audio.c')
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-audio.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c b/drivers/media/usb/cx231xx/cx231xx-audio.c
index de4ae5eb4830..a6a9508418f8 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) {
+ dev_dbg(dev->dev, "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) {