Add a missing free(allocation) inside allocation_tracker_notify_free()
when freeing a memory buffer.
Prior to switching the allocation tracker to use C++ unordered_map,
the "allocation" bin was kept within (and reused) by the older hash_map
mechanism. However, after the switch to the C++ unordered_map this
is no longer the case, hence the memory leak.
Test: watch -n 1 "adb shell dumpsys meminfo -d BT-PID | grep Heap"
Bug:
34785845
Change-Id: I737c901a6452d29d18fd8b847e7d5ea10c5ff485
// Double-free of memory is detected with "assert(allocation)" above
// as the allocation entry will not be present.
allocations.erase(ptr);
+ free(allocation);
return ((char*)ptr) - canary_size;
}