diff options
| author | Mathias Agopian <mathias@google.com> | 2010-03-30 16:53:40 -0700 |
|---|---|---|
| committer | Mathias Agopian <mathias@google.com> | 2010-03-30 19:02:59 -0700 |
| commit | 544592e14f8d7643238e40ba9879727497900f35 (patch) | |
| tree | 2c0dcab787aa99c58d3af4b4b1fd2b1aa912b86b /libs/utils/VectorImpl.cpp | |
| parent | 77c560f3d7891d9ae1ad714b5f65a22ff4f4c06b (diff) | |
| download | frameworks_base-544592e14f8d7643238e40ba9879727497900f35.zip frameworks_base-544592e14f8d7643238e40ba9879727497900f35.tar.gz frameworks_base-544592e14f8d7643238e40ba9879727497900f35.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/VectorImpl.cpp')
| -rw-r--r-- | libs/utils/VectorImpl.cpp | 2 |
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); |
