From: Michal MalĂ˝ Date: Fri, 31 Jul 2015 14:12:01 +0000 (+0200) Subject: Zeroize the SDL_HapticEffect structure before use X-Git-Url: https://gitweb.devoid-pointer.net/?a=commitdiff_plain;h=0b7e473e092cfbc5077faf2bf6245a37d148aec4;p=FFBChecker.git Zeroize the SDL_HapticEffect structure before use --- diff --git a/sdl2ffbeffect.cpp b/sdl2ffbeffect.cpp index 9133d3d..cc407a9 100644 --- a/sdl2ffbeffect.cpp +++ b/sdl2ffbeffect.cpp @@ -23,7 +23,13 @@ const QString SDL2FFBEffect::CAPTION("Invalid FFB parameter"); SDL_HapticEffect* SDL2FFBEffect::createFFstruct() { - return new SDL_HapticEffect; + SDL_HapticEffect* effect = new SDL_HapticEffect; + if (effect == nullptr) + return nullptr; + + memset(effect, 0, sizeof(SDL_HapticEffect)); + + return effect; } bool SDL2FFBEffect::checkEnvelopeParameters(const int attackLength, const int attackLevel, const int fadeLength, const int fadeLevel)