From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH v2 1/4] iio:kfifo: Fix memory leak
Date: Tue, 15 Oct 2013 10:30:27 +0200 [thread overview]
Message-ID: <1381825830-25581-1-git-send-email-lars@metafoo.de> (raw)
We need to free the kfifo when we release the buffer, otherwise the fifos memory
will be leaked.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
New in v2
Btw. This is all against togreg, since it is probably already to late for
fixes-togreg.
---
drivers/iio/kfifo_buf.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/kfifo_buf.c b/drivers/iio/kfifo_buf.c
index b4ac55a..ce51092 100644
--- a/drivers/iio/kfifo_buf.c
+++ b/drivers/iio/kfifo_buf.c
@@ -132,7 +132,10 @@ static int iio_read_first_n_kfifo(struct iio_buffer *r,
static void iio_kfifo_buffer_release(struct iio_buffer *buffer)
{
- kfree(iio_to_kfifo(buffer));
+ struct iio_kfifo *kf = iio_to_kfifo(buffer);
+
+ kfifo_free(&kf->kf);
+ kfree(kf);
}
static const struct iio_buffer_access_funcs kfifo_access_funcs = {
--
1.8.0
next reply other threads:[~2013-10-15 8:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-15 8:30 Lars-Peter Clausen [this message]
2013-10-15 8:30 ` [PATCH v2 2/4] iio:kfifo: Protect against concurrent access from userspace Lars-Peter Clausen
2013-10-15 18:19 ` Jonathan Cameron
2013-10-15 8:30 ` [PATCH v2 3/4] iio:kfifo: Empty buffer on update Lars-Peter Clausen
2013-10-15 18:20 ` Jonathan Cameron
2013-10-15 8:30 ` [PATCH v2 4/4] iio:kfifo: Set update_needed to false after allocating a new buffer Lars-Peter Clausen
2013-10-15 18:20 ` Jonathan Cameron
2013-10-15 18:19 ` [PATCH v2 1/4] iio:kfifo: Fix memory leak Jonathan Cameron
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=1381825830-25581-1-git-send-email-lars@metafoo.de \
--to=lars@metafoo.de \
--cc=jic23@kernel.org \
--cc=linux-iio@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).