From 9b83a2a0439bb79cb4a52cbe33e95842b9539464 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Thu, 21 Jun 2018 17:52:39 -0400 Subject: [PATCH] BJoystick: Fix fJoystickInfo initialization. joystick_info contains BLists which initialize themselves upon new(), and Clang warned (correctly) that using memset() overwites that, as well as RTTI and other data that they contain. So instead, only memset the first part of the struct, and then manually initialize the other members. Fixes #14217. --- src/kits/device/Joystick.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/kits/device/Joystick.cpp b/src/kits/device/Joystick.cpp index 6ec405de78..4233033328 100644 --- a/src/kits/device/Joystick.cpp +++ b/src/kits/device/Joystick.cpp @@ -62,8 +62,11 @@ BJoystick::BJoystick() sLogFile = fopen("/var/log/joystick.log", "a"); #endif - if (fJoystickInfo != NULL) - memset(fJoystickInfo, 0, sizeof(joystick_info)); + if (fJoystickInfo != NULL) { + memset(&fJoystickInfo->module_info, 0, sizeof(joystick_module_info)); + fJoystickInfo->calibration_enable = false; + fJoystickInfo->max_latency = 0; + } RescanDevices(); }