summaryrefslogtreecommitdiff
path: root/libs/androidfw/StringPool.cpp
diff options
context:
space:
mode:
author Arpit Singh <arpitks@google.com> 2024-03-19 18:09:52 +0000
committer Arpit Singh <arpitks@google.com> 2024-03-25 13:32:28 +0000
commitccf459961749795384aa3e4426f6253a169e1751 (patch)
tree0c4c65b1b7312d54acb659b0e55ed00c8bf96cd7 /libs/androidfw/StringPool.cpp
parent773f951121add4e9b60d6e6b698e5f3e894906fe (diff)
Refactor native MotionEvent_obtain to avoid possible memory leak
android_view_MotionEvent_setNativePtr doesn't check if the supplied java MotionEvent already holds a native pointer before overwriting it. This can potentially cause native MotionEvent object to be leaked. Currently this is only used in android_view_MotionEvent_obtainFromNative without checking for existing native pointer in corresponding java object. This can potantially leak native heap in android.view.MotionPredictor if the obtained java MotionEvent was recycled and holding a native MotionEvent object. In this CL we change it to first check for existing native object and copy the data instead avoiding allocating new native MotionEvent. This will also allow us to safely use it in MotionEvent_obtainAsCopy method. Test: atest MotionEventTest Bug: 328562482 Bug: 324375527 Change-Id: Iff6b4211ea23a940dcfe3acddd4464ccdc0799d1
Diffstat (limited to 'libs/androidfw/StringPool.cpp')
0 files changed, 0 insertions, 0 deletions