From: Shaun Ren <sren@codeweavers.com> --- dlls/xinput1_3/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/xinput1_3/main.c b/dlls/xinput1_3/main.c index d25c234b5cf..8530b028d5e 100644 --- a/dlls/xinput1_3/main.c +++ b/dlls/xinput1_3/main.c @@ -374,13 +374,15 @@ static BOOL controller_init(struct xinput_controller *controller, PHIDP_PREPARSE if (!(controller->hid.input_report_buf = calloc(1, controller->hid.caps.InputReportByteLength))) goto failed; if (!(controller->hid.output_report_buf = calloc(1, controller->hid.caps.OutputReportByteLength))) goto failed; - set_current_state(controller - controllers, &state); memset(&controller->vibration, 0, sizeof(controller->vibration)); lstrcpynW(controller->device_path, device_path, MAX_PATH); controller->enabled = FALSE; controller->device = device; - if (controller_enable(controller)) return TRUE; + if (!controller_enable(controller)) goto failed; + + set_current_state(controller - controllers, &state); + return TRUE; failed: free(controller->hid.input_report_buf); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11192