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-20 16:46:11 -0700
commit489c3a8b356a7a3ae235afec5e1e954f90301622 (patch)
treed41bab98a59473547fdf21bb8c3cc3eb873e9991 /trusty/coverage/coverage.cpp
parent3ab681c9a8a7de8b7f004b9e6afec749cdcbd5e5 (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
Diffstat (limited to 'trusty/coverage/coverage.cpp')
0 files changed, 0 insertions, 0 deletions