Skip to content

Commit

Permalink
Merge branch 'for-5.15/thrustmaster' into for-linus
Browse files Browse the repository at this point in the history
- Fixes for memory leaks
  • Loading branch information
Jiri Kosina committed Sep 1, 2021
2 parents 854a958 + c3800ee commit fcbc26e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/hid/hid-thrustmaster.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit fcbc26e

Please sign in to comment.