iio/adjd_s311: Fix potential memory leak in adjd_s311_update_scan_mode()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Wed, 8 Aug 2012 09:58:00 +0000 (10:58 +0100)
committerJonathan Cameron <jic23@kernel.org>
Thu, 16 Aug 2012 19:24:33 +0000 (20:24 +0100)
commit1c795ebd00042b3a5c97e049fd1c08763714a7a8
treeb54a55288bec44e39acdd6f6282f6b4d568afb23
parent8857df3aceb7a8eb7558059b7da109e41dd1fb95
iio/adjd_s311: Fix potential memory leak in adjd_s311_update_scan_mode()

Do not leak memory by updating pointer with potentially NULL realloc return value.
There is no need to preserve data in the buffer,
so replace krealloc() by kfree()-kmalloc() pair.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/light/adjd_s311.c