Merge "Fix use after free in InputClassifier"
diff --git a/services/inputflinger/InputClassifier.cpp b/services/inputflinger/InputClassifier.cpp
index 09a004c..3905ed0 100644
--- a/services/inputflinger/InputClassifier.cpp
+++ b/services/inputflinger/InputClassifier.cpp
@@ -705,13 +705,12 @@
}
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(©Args);
}
void InputClassifier::notifySwitch(const NotifySwitchArgs* args) {