summaryrefslogtreecommitdiffstats
path: root/libs/utils
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-03-30 16:53:40 -0700
committerMathias Agopian <mathias@google.com>2010-03-30 19:02:59 -0700
commit77e26d6822bdba470c4704440fdafcc256475b4e (patch)
tree5fd50fb4ef04634bd4383041447a1dbd81847574 /libs/utils
parent964d29a953d273867090c8cb746e8dade511091d (diff)
downloadframeworks_native-77e26d6822bdba470c4704440fdafcc256475b4e.zip
frameworks_native-77e26d6822bdba470c4704440fdafcc256475b4e.tar.gz
frameworks_native-77e26d6822bdba470c4704440fdafcc256475b4e.tar.bz2
fix [2542425] memory leak during video recording
[Sorted|Keyed]Vector<TYPE> would leak their whole storage when resized from the end and TYPE had trivial dtor and copy operators. Change-Id: I8555bb1aa0863df72de27d67ae50e20706e90cf5
Diffstat (limited to 'libs/utils')
-rw-r--r--libs/utils/VectorImpl.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libs/utils/VectorImpl.cpp b/libs/utils/VectorImpl.cpp
index 0322af7..4954ffe 100644
--- a/libs/utils/VectorImpl.cpp
+++ b/libs/utils/VectorImpl.cpp
@@ -351,6 +351,7 @@ void* VectorImpl::_grow(size_t where, size_t amount)
{
const SharedBuffer* cur_sb = SharedBuffer::sharedBuffer(mStorage);
SharedBuffer* sb = cur_sb->editResize(new_capacity * mItemSize);
+ release_storage();
mStorage = sb->data();
} else {
SharedBuffer* sb = SharedBuffer::alloc(new_capacity * mItemSize);
@@ -403,6 +404,7 @@ void VectorImpl::_shrink(size_t where, size_t amount)
{
const SharedBuffer* cur_sb = SharedBuffer::sharedBuffer(mStorage);
SharedBuffer* sb = cur_sb->editResize(new_capacity * mItemSize);
+ release_storage();
mStorage = sb->data();
} else {
SharedBuffer* sb = SharedBuffer::alloc(new_capacity * mItemSize);