summaryrefslogtreecommitdiff
path: root/drivers/staging/iio
diff options
context:
space:
mode:
authorPeter Meerwald <pmeerw@pmeerw.net>2012-08-22 20:37:00 +0100
committerJonathan Cameron <jic23@kernel.org>2012-08-27 19:09:25 +0100
commitd1dc9c1276a4d988b29372fe67796430d5cbc756 (patch)
tree7f7fe97fdeac9f96d8ef5f2766c8d8b4d8383289 /drivers/staging/iio
parent50d4b3062d6d4f165c76854a7644b1502836f9b9 (diff)
staging iio: fix potential memory leak in lis3l02dq_ring.c
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r--drivers/staging/iio/accel/lis3l02dq_ring.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c
index 18d108fd967a..f3da59063ed2 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]);