summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-10-15 08:30:00 (GMT)
committerJonathan Cameron <jic23@kernel.org>2013-10-15 18:18:34 (GMT)
commitf6c23f483937b8be53f313ec31068acdca91a25d (patch)
tree4b976bdb8eebfaa0ece42df5d2c779c3d3a37cbf /drivers
parentef4d4d1b8f2cda46ed483ee2f0d6f5b63bc7c020 (diff)
downloadlinux-fsl-qoriq-f6c23f483937b8be53f313ec31068acdca91a25d.tar.xz
iio:kfifo: Fix memory leak
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> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iio/kfifo_buf.c5
1 files changed, 4 insertions, 1 deletions
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 = {