summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2021-09-01 22:04:05 +0200
committerJiri Kosina <jkosina@suse.cz>2021-09-01 22:04:05 +0200
commitfcbc26eb92545ba5e2828f2dcffd1c4bdd82b373 (patch)
tree101bee4f5372c891f2b31a4bfcdbdb8a7f439a7e
parent854a95877f4d95b65918cb126fdc0c84ea564676 (diff)
parentc3800eed22d21c66912b4461a403b4448ed88d95 (diff)
downloadlinux-fcbc26eb92545ba5e2828f2dcffd1c4bdd82b373.tar.bz2
Merge branch 'for-5.15/thrustmaster' into for-linus
- Fixes for memory leaks
-rw-r--r--drivers/hid/hid-thrustmaster.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/hid/hid-thrustmaster.c b/drivers/hid/hid-thrustmaster.c
index cdc7d82ae9ed..d44550aa8805 100644
--- a/drivers/hid/hid-thrustmaster.c
+++ b/drivers/hid/hid-thrustmaster.c
@@ -173,6 +173,7 @@ static void thrustmaster_interrupts(struct hid_device *hdev)
if (ret) {
hid_err(hdev, "setup data couldn't be sent\n");
+ kfree(send_buf);
return;
}
}
@@ -253,6 +254,7 @@ static void thrustmaster_remove(struct hid_device *hdev)
usb_kill_urb(tm_wheel->urb);
+ kfree(tm_wheel->change_request);
kfree(tm_wheel->response);
kfree(tm_wheel->model_request);
usb_free_urb(tm_wheel->urb);
@@ -336,11 +338,14 @@ static int thrustmaster_probe(struct hid_device *hdev, const struct hid_device_i
);
ret = usb_submit_urb(tm_wheel->urb, GFP_ATOMIC);
- if (ret)
+ if (ret) {
hid_err(hdev, "Error %d while submitting the URB. I am unable to initialize this wheel...\n", ret);
+ goto error6;
+ }
return ret;
+error6: kfree(tm_wheel->change_request);
error5: kfree(tm_wheel->response);
error4: kfree(tm_wheel->model_request);
error3: usb_free_urb(tm_wheel->urb);