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>
This commit is contained in:
Родитель
50d4b3062d
Коммит
d1dc9c1276
|
@ -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]);
|
||||
|
|
Загрузка…
Ссылка в новой задаче