linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Baptiste Theou <jtheou@adeneo-embedded.us>
To: <linux-media@vger.kernel.org>
Cc: Jean-Baptiste Theou <jtheou@adeneo-embedded.us>
Subject: [PATCH] [media] cx231xx: Fix memory leak
Date: Fri, 8 Jan 2016 13:10:50 -0800	[thread overview]
Message-ID: <1452287450-17623-1-git-send-email-jtheou@adeneo-embedded.us> (raw)

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


             reply	other threads:[~2016-01-08 21:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08 21:10 Jean-Baptiste Theou [this message]
2016-01-08 21:55 ` [PATCH] [media] cx231xx: Fix memory leak kbuild test robot
2016-01-08 22:02 ` [PATCH v2] " Jean-Baptiste Theou
  -- strict thread matches above, loose matches on Subject: below --
2016-03-07 10:22 [PATCH] [media] cx231xx: fix " Sudip Mukherjee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452287450-17623-1-git-send-email-jtheou@adeneo-embedded.us \
    --to=jtheou@adeneo-embedded.us \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).