Skip to content

Commit

Permalink
staging iio: fix potential memory leak in lis3l02dq_ring.c
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Peter Meerwald authored and Jonathan Cameron committed Aug 27, 2012
1 parent 50d4b30 commit d1dc9c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/staging/iio/accel/lis3l02dq_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit d1dc9c1

Please sign in to comment.