From 163de8e697bb9353c56bb8f43248bfa73ffa417c Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 4 Dec 2023 21:45:39 -0800 Subject: [PATCH] Fixed warning C6001: Using uninitialized memory 'rdi'. --- src/joystick/windows/SDL_rawinputjoystick.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c index 3302e873e..f4e68b7bc 100644 --- a/src/joystick/windows/SDL_rawinputjoystick.c +++ b/src/joystick/windows/SDL_rawinputjoystick.c @@ -852,7 +852,7 @@ static void RAWINPUT_AddDevice(HANDLE hDevice) SDL_RAWINPUT_Device *curr, *last; RID_DEVICE_INFO rdi; UINT size; - char dev_name[MAX_PATH]; + char dev_name[MAX_PATH] = { 0 }; HANDLE hFile = INVALID_HANDLE_VALUE; /* Make sure we're not trying to add the same device twice */ @@ -862,6 +862,7 @@ static void RAWINPUT_AddDevice(HANDLE hDevice) /* Figure out what kind of device it is */ size = sizeof(rdi); + SDL_zero(rdi); CHECK(GetRawInputDeviceInfoA(hDevice, RIDI_DEVICEINFO, &rdi, &size) != (UINT)-1); CHECK(rdi.dwType == RIM_TYPEHID);