Commit f6c23f483937b8be53f313ec31068acdca91a25d

Authored by Lars-Peter Clausen
Committed by Jonathan Cameron
1 parent ef4d4d1b8f

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>

Showing 1 changed file with 4 additions and 1 deletions Side-by-side Diff

drivers/iio/kfifo_buf.c
... ... @@ -132,7 +132,10 @@
132 132  
133 133 static void iio_kfifo_buffer_release(struct iio_buffer *buffer)
134 134 {
135   - kfree(iio_to_kfifo(buffer));
  135 + struct iio_kfifo *kf = iio_to_kfifo(buffer);
  136 +
  137 + kfifo_free(&kf->kf);
  138 + kfree(kf);
136 139 }
137 140  
138 141 static const struct iio_buffer_access_funcs kfifo_access_funcs = {