* [PATCH] staging iio: fix potential memory leak in lis3l02dq_ring.c
@ 2012-08-22 19:37 Peter Meerwald
2012-08-27 18:06 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Peter Meerwald @ 2012-08-22 19:37 UTC (permalink / raw)
To: linux-iio; +Cc: Peter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
---
drivers/staging/iio/accel/lis3l02dq_ring.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c
index 18d108f..f3da590 100644
--- a/drivers/staging/iio/accel/lis3l02dq_ring.c
+++ b/drivers/staging/iio/accel/lis3l02dq_ring.c
@@ -121,8 +121,10 @@ static int lis3l02dq_get_buffer_element(struct iio_dev *indio_dev,
if (rx_array == NULL)
return -ENOMEM;
ret = lis3l02dq_read_all(indio_dev, rx_array);
- if (ret < 0)
+ if (ret < 0) {
+ kfree(rx_array);
return ret;
+ }
for (i = 0; i < scan_count; i++)
data[i] = combine_8_to_16(rx_array[i*4+1],
rx_array[i*4+3]);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] staging iio: fix potential memory leak in lis3l02dq_ring.c
2012-08-22 19:37 [PATCH] staging iio: fix potential memory leak in lis3l02dq_ring.c Peter Meerwald
@ 2012-08-27 18:06 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2012-08-27 18:06 UTC (permalink / raw)
To: Peter Meerwald; +Cc: linux-iio
On 08/22/2012 08:37 PM, Peter Meerwald wrote:
> Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Thanks, merged to fixes-togreg.
> ---
> drivers/staging/iio/accel/lis3l02dq_ring.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c
> index 18d108f..f3da590 100644
> --- a/drivers/staging/iio/accel/lis3l02dq_ring.c
> +++ b/drivers/staging/iio/accel/lis3l02dq_ring.c
> @@ -121,8 +121,10 @@ static int lis3l02dq_get_buffer_element(struct iio_dev *indio_dev,
> if (rx_array == NULL)
> return -ENOMEM;
> ret = lis3l02dq_read_all(indio_dev, rx_array);
> - if (ret < 0)
> + if (ret < 0) {
> + kfree(rx_array);
> return ret;
> + }
> for (i = 0; i < scan_count; i++)
> data[i] = combine_8_to_16(rx_array[i*4+1],
> rx_array[i*4+3]);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-27 18:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-22 19:37 [PATCH] staging iio: fix potential memory leak in lis3l02dq_ring.c Peter Meerwald
2012-08-27 18:06 ` Jonathan Cameron
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.