Rémi Bernon : dinput: Fix invalid use of post-incremented device_count value.

Alexandre Julliard julliard at winehq.org
Tue Oct 12 16:12:49 CDT 2021


Module: wine
Branch: master
Commit: 50f889fd19d329bef7c001f9eafd1030fc1e3a56
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=50f889fd19d329bef7c001f9eafd1030fc1e3a56

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue Oct 12 22:31:44 2021 +0200

dinput: Fix invalid use of post-incremented device_count value.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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;
             }
         }




More information about the wine-cvs mailing list