[PATCH] iio: light: hid-sensor-prox: Fix memory leak in hid_prox_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When prox_parse_report() fails we should free the previously allocated 
'channels' struct.

Reported-by: Alexey Khoroshilov <khoroshilov@xxxxxxxxx>
Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
---
 drivers/iio/light/hid-sensor-prox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index 91ecc46..f76ef0f 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -332,7 +332,7 @@ error_remove_trigger:
 error_unreg_buffer_funcs:
 	iio_triggered_buffer_cleanup(indio_dev);
 error_free_dev_mem:
-	kfree(indio_dev->channels);
+	kfree(channels);
 	return ret;
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux