diff options
author | Andreas Gampe <agampe@google.com> | 2014-10-24 21:32:07 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2014-10-24 21:32:07 -0700 |
commit | dc8aa69496ea43f0a60f1f527822a90f6c3d6d03 (patch) | |
tree | 7c60de57e6e3e43f4c1797e58238e62f8e447134 /runtime/base | |
parent | dc9667e50f6adf99f2d4cfea27b4abcbf42e6a3f (diff) | |
download | art-dc8aa69496ea43f0a60f1f527822a90f6c3d6d03.zip art-dc8aa69496ea43f0a60f1f527822a90f6c3d6d03.tar.gz art-dc8aa69496ea43f0a60f1f527822a90f6c3d6d03.tar.bz2 |
ART: Fix leak in bit_vector
Resizing leaks the original storage. Let the allocator know it's
free.
Bug: 18120044
Change-Id: Ib95a87c3036f36377d64351173f8c04f28855663
Diffstat (limited to 'runtime/base')
-rw-r--r-- | runtime/base/bit_vector.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/runtime/base/bit_vector.cc b/runtime/base/bit_vector.cc index 5b8b6e2..71dec7a 100644 --- a/runtime/base/bit_vector.cc +++ b/runtime/base/bit_vector.cc @@ -320,7 +320,12 @@ void BitVector::EnsureSize(uint32_t idx) { memcpy(new_storage, storage_, storage_size_ * kWordBytes); // Zero out the new storage words. memset(&new_storage[storage_size_], 0, (new_size - storage_size_) * kWordBytes); - // TOTO: collect stats on space wasted because of resize. + // TODO: collect stats on space wasted because of resize. + + // Free old storage. + allocator_->Free(storage_); + + // Set fields. storage_ = new_storage; storage_size_ = new_size; } |