diff options
author | Ryan Mitchell <rtmitchell@google.com> | 2020-06-22 13:00:58 -0700 |
---|---|---|
committer | Ryan Mitchell <rtmitchell@google.com> | 2020-06-22 15:50:14 -0700 |
commit | c4142d91f5c549f7f3661aeb90d344641deabf62 (patch) | |
tree | 7de19be71919c03e59fd75c6301ac6092b78b09b /libs/androidfw/include | |
parent | bb2d9a52c1592b04314615956bb43856ce3cd480 (diff) |
libafw: Use std::free explicitly for overlays
Currently we rely on libc to call std::free on the malloced pointer to
the overlay table entry. Rather than relying on the libc implementation
to call std::free instead of trying to delete the pointer as if it was
created using "new", explicitly pass std::free as the deleter to the
data held by the std::shared_ptr.
Bug: 159562360
Test: Observed no heap growth while looping infinitely and retrieving
a string resource overlaid using an inline xml value
Change-Id: I9a2ebaf9a993ad9c44fab8f052430c8142d4347d
Diffstat (limited to 'libs/androidfw/include')
-rw-r--r-- | libs/androidfw/include/androidfw/ResourceTypes.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/androidfw/include/androidfw/ResourceTypes.h b/libs/androidfw/include/androidfw/ResourceTypes.h index 21be81cb85bd..e351a46d633a 100644 --- a/libs/androidfw/include/androidfw/ResourceTypes.h +++ b/libs/androidfw/include/androidfw/ResourceTypes.h @@ -1601,8 +1601,8 @@ class ResTable_entry_handle { entry_ = handle.entry_; } - inline static ResTable_entry_handle managed(ResTable_entry* entry) { - return ResTable_entry_handle(std::shared_ptr<const ResTable_entry>(entry)); + inline static ResTable_entry_handle managed(ResTable_entry* entry, void (*deleter)(void *)) { + return ResTable_entry_handle(std::shared_ptr<const ResTable_entry>(entry, deleter)); } inline static ResTable_entry_handle unmanaged(const ResTable_entry* entry) { |