From f6c23f483937b8be53f313ec31068acdca91a25d Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 15 Oct 2013 09:30:00 +0100 Subject: [PATCH] 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 Signed-off-by: Jonathan Cameron --- 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 b4ac55a29fc4..ce51092695ab 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 = { -- 2.34.1