Skip to content

Commit fcbc26e

Browse files
author
Jiri Kosina
committed
Merge branch 'for-5.15/thrustmaster' into for-linus
- Fixes for memory leaks
2 parents 854a958 + c3800ee commit fcbc26e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/hid/hid-thrustmaster.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ static void thrustmaster_interrupts(struct hid_device *hdev)
173173

174174
if (ret) {
175175
hid_err(hdev, "setup data couldn't be sent\n");
176+
kfree(send_buf);
176177
return;
177178
}
178179
}
@@ -253,6 +254,7 @@ static void thrustmaster_remove(struct hid_device *hdev)
253254

254255
usb_kill_urb(tm_wheel->urb);
255256

257+
kfree(tm_wheel->change_request);
256258
kfree(tm_wheel->response);
257259
kfree(tm_wheel->model_request);
258260
usb_free_urb(tm_wheel->urb);
@@ -336,11 +338,14 @@ static int thrustmaster_probe(struct hid_device *hdev, const struct hid_device_i
336338
);
337339

338340
ret = usb_submit_urb(tm_wheel->urb, GFP_ATOMIC);
339-
if (ret)
341+
if (ret) {
340342
hid_err(hdev, "Error %d while submitting the URB. I am unable to initialize this wheel...\n", ret);
343+
goto error6;
344+
}
341345

342346
return ret;
343347

348+
error6: kfree(tm_wheel->change_request);
344349
error5: kfree(tm_wheel->response);
345350
error4: kfree(tm_wheel->model_request);
346351
error3: usb_free_urb(tm_wheel->urb);

0 commit comments

Comments
 (0)