hid: hid-playstation: fix memleak in probe
Subsystems (2)
PATCH 1/1 hid: hid-playstation: fix memleak in probe
Free the buffer if we bail out in the error case of dualshock4_get_calibration_data()
Signed-off-by Oliver Neukum <[email protected]>
--- drivers/hid/hid-playstation.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/hid-playstation.c +2 -0
@@ -1942,6 +1942,7 @@ static int dualshock4_get_calibration_data(struct dualshock4 *ds4)"Failed to retrieve DualShock4 calibration info: %d\n" , ret); ret = -EILSEQ ; +kfree (buf); goto transfer_failed; }else {break ;
@@ -1959,6 +1960,7 @@ static int dualshock4_get_calibration_data(struct dualshock4 *ds4)if (ret) {hid_warn (hdev,"Failed to retrieve DualShock4 calibration info: %d\n" , ret); +kfree (buf); goto transfer_failed; } }
Signature · 1 line
2.51.1
Quoted 7 lines · Oliver Neukum
Free the buffer if we bail out in the error case of
dualshock4_get_calibration_data()Signed-off-by Oliver Neukum <[email protected]>--- drivers/hid/hid-playstation.c | 2 ++ 1 file changed, 2 insertions(+)
This LGTM!
Reviewed-by Silvan Jegen <[email protected]>
Quoted 21 lines
drivers/hid/hid-playstation.c +2
-0@@ -1942,6 +1942,7 @@ static int dualshock4_get_calibration_data(struct dualshock4 *ds4)"Failed to retrieve DualShock4 calibration info: %d\n" , ret); ret = -EILSEQ ; +kfree (buf); goto transfer_failed; }else {break ;@@ -1959,6 +1960,7 @@ static int dualshock4_get_calibration_data(struct dualshock4 *ds4)if (ret) {hid_warn (hdev,"Failed to retrieve DualShock4 calibration info: %d\n" , ret); +kfree (buf); goto transfer_failed; } }