diff options
author | Peter Meerwald <pmeerw@pmeerw.net> | 2012-08-22 20:37:00 +0100 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2012-08-27 19:09:25 +0100 |
commit | d1dc9c1276a4d988b29372fe67796430d5cbc756 (patch) | |
tree | 7f7fe97fdeac9f96d8ef5f2766c8d8b4d8383289 /drivers/staging/iio/accel/lis3l02dq_ring.c | |
parent | 50d4b3062d6d4f165c76854a7644b1502836f9b9 (diff) | |
download | linux-3.10-d1dc9c1276a4d988b29372fe67796430d5cbc756.tar.gz linux-3.10-d1dc9c1276a4d988b29372fe67796430d5cbc756.tar.bz2 linux-3.10-d1dc9c1276a4d988b29372fe67796430d5cbc756.zip |
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/accel/lis3l02dq_ring.c')
-rw-r--r-- | drivers/staging/iio/accel/lis3l02dq_ring.c | 4 |
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 18d108fd967..f3da59063ed 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]); |