Commit d1dc9c12 authored by Peter Meerwald's avatar Peter Meerwald Committed by Jonathan Cameron

staging iio: fix potential memory leak in lis3l02dq_ring.c

Signed-off-by: default avatarPeter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 50d4b306
...@@ -121,8 +121,10 @@ static int lis3l02dq_get_buffer_element(struct iio_dev *indio_dev, ...@@ -121,8 +121,10 @@ static int lis3l02dq_get_buffer_element(struct iio_dev *indio_dev,
if (rx_array == NULL) if (rx_array == NULL)
return -ENOMEM; return -ENOMEM;
ret = lis3l02dq_read_all(indio_dev, rx_array); ret = lis3l02dq_read_all(indio_dev, rx_array);
if (ret < 0) if (ret < 0) {
kfree(rx_array);
return ret; return ret;
}
for (i = 0; i < scan_count; i++) for (i = 0; i < scan_count; i++)
data[i] = combine_8_to_16(rx_array[i*4+1], data[i] = combine_8_to_16(rx_array[i*4+1],
rx_array[i*4+3]); rx_array[i*4+3]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment