summaryrefslogtreecommitdiff
path: root/trusty/coverage/coverage.cpp
diff options
context:
space:
mode:
authorYong Li <yongl0722@gmail.com>2020-03-19 18:43:06 +0000
committerChristopher Ferris <cferris@google.com>2020-03-23 13:47:00 -0700
commit4ad538376aabae518bfbf5c32356f4d6fb1b2d6e (patch)
tree3e6e4d23d61d52ac30d0be30c8796cb9d7324606 /trusty/coverage/coverage.cpp
parentbaaf2a44fb48dd07a50e29eaadd596e9777bf6bd (diff)
Fix memory leak of DexFile handle after release
The DexFile handle is allocated from heap in OpenFromFd/OpenFromMemory. After releasing the unique_ptr, the DexFile handle itself is no longer managed by the smart pointer. However, the DexFile handle is not freed in the constructor of DexFileFromFile/DexFileFromMemory. This change uses get() method to get the DexFile pointer while allowing it to be managed by smart pointer so that it can be freed after method end. Added new unit tests to detect leaks. Bug: 151966190 Test: Unwinding can still retrieve dex frame information during crash. Test: Ran new unit tests before change and verified they fail, ran them Test: after the change and verified they don't fail. Signed-off-by: Yong Li <yongl0722@gmail.com> Change-Id: I0627e1e255eb6644aba51e940c1a79ff78d568d7 (cherry picked from commit 489c3a8b356a7a3ae235afec5e1e954f90301622)
Diffstat (limited to 'trusty/coverage/coverage.cpp')
0 files changed, 0 insertions, 0 deletions