From 50f889fd19d329bef7c001f9eafd1030fc1e3a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 12 Oct 2021 22:31:44 +0200 Subject: [PATCH] dinput: Fix invalid use of post-incremented device_count value. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/dinput/dinput_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index b385cc7503c..bc35d6d77b3 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -833,7 +833,8 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics( if (enumSuccess == S_OK && should_enumerate_device(ptszUserName, dwFlags, &This->device_players, &didevi.guidInstance)) { - didevis = realloc( didevis, sizeof(DIDEVICEINSTANCEW) * device_count++ ); + device_count++; + didevis = realloc( didevis, sizeof(DIDEVICEINSTANCEW) * device_count ); didevis[device_count-1] = didevi; } }