Commit 9dd73448 authored by Jean-Baptiste Theou's avatar Jean-Baptiste Theou Committed by Mauro Carvalho Chehab

[media] cx231xx: Fix memory leak

dma_area needs to be freed when the device is closed.

Based on em23xx-audio.c
Signed-off-by: default avatarJean-Baptiste Theou <jtheou@adeneo-embedded.us>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent aeae69da
...@@ -499,6 +499,11 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream) ...@@ -499,6 +499,11 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream)
} }
dev->adev.users--; 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); mutex_unlock(&dev->lock);
if (dev->adev.users == 0 && dev->adev.shutdown == 1) { if (dev->adev.users == 0 && dev->adev.shutdown == 1) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment