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>
This commit is contained in:
Lars-Peter Clausen 2013-10-15 09:30:00 +01:00 committed by Jonathan Cameron
parent ef4d4d1b8f
commit f6c23f4839
1 changed files with 4 additions and 1 deletions

View File

@ -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) 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 = { static const struct iio_buffer_access_funcs kfifo_access_funcs = {