Re: [PATCH v2 1/4] iio:kfifo: Fix memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/15/13 09:30, Lars-Peter Clausen wrote:
> 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@xxxxxxxxxx>
Applied to the togreg branch.
> 
> ---
> New in v2
> 
> Btw. This is all against togreg, since it is probably already to late for
> fixes-togreg.
Indeed, probably is.

We should work out which of these we want stable to pick up at somepoint though...

> ---
>  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 = {
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux