Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2320aba authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Fix use after free in InputClassifier

Do not send address of a variable outside of the scope of the variable.

Test: presubmit
Bug: 124232816
Change-Id: I18b4e27ef333f3a8354bdeba89ea2a912106cdaa
parent a028c449
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -705,13 +705,12 @@ void InputClassifier::notifyKey(const NotifyKeyArgs* args) {
}

void InputClassifier::notifyMotion(const NotifyMotionArgs* args) {
    NotifyMotionArgs copyArgs = NotifyMotionArgs(*args);
    if (mMotionClassifier && isTouchEvent(*args)) {
        // We only cover touch events, for now.
        NotifyMotionArgs newArgs = NotifyMotionArgs(*args);
        newArgs.classification = mMotionClassifier->classify(newArgs);
        args = &newArgs;
        copyArgs.classification = mMotionClassifier->classify(copyArgs);
    }
    mListener->notifyMotion(args);
    mListener->notifyMotion(&copyArgs);
}

void InputClassifier::notifySwitch(const NotifySwitchArgs* args) {