summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-03-29 15:44:33 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-03-29 15:44:33 -0700
commit04fdd180cc64f2724c8b8598f1b8495fb1fa1d93 (patch)
treea96af36746d858ea6358282e1f4c1be069f2ee0c /libs
parentc46f28dc0fde1889b37bdc7066ec2af96c16e358 (diff)
parentd74145285373193af8584ac86ee73c7aea3e1600 (diff)
downloadframeworks_base-04fdd180cc64f2724c8b8598f1b8495fb1fa1d93.zip
frameworks_base-04fdd180cc64f2724c8b8598f1b8495fb1fa1d93.tar.gz
frameworks_base-04fdd180cc64f2724c8b8598f1b8495fb1fa1d93.tar.bz2
Merge "fix [2542425] memory leak during video recording" into froyo
Diffstat (limited to 'libs')
-rw-r--r--libs/utils/VectorImpl.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libs/utils/VectorImpl.cpp b/libs/utils/VectorImpl.cpp
index 2c2d667..0322af7 100644
--- a/libs/utils/VectorImpl.cpp
+++ b/libs/utils/VectorImpl.cpp
@@ -173,9 +173,10 @@ status_t VectorImpl::sort(VectorImpl::compar_r_t cmp, void* state)
if (!array) return NO_MEMORY;
temp = malloc(mItemSize);
if (!temp) return NO_MEMORY;
- _do_construct(temp, 1);
item = reinterpret_cast<char*>(array) + mItemSize*(i);
curr = reinterpret_cast<char*>(array) + mItemSize*(i-1);
+ } else {
+ _do_destroy(temp, 1);
}
_do_copy(temp, item, 1);
@@ -183,12 +184,14 @@ status_t VectorImpl::sort(VectorImpl::compar_r_t cmp, void* state)
ssize_t j = i-1;
void* next = reinterpret_cast<char*>(array) + mItemSize*(i);
do {
+ _do_destroy(next, 1);
_do_copy(next, curr, 1);
next = curr;
--j;
curr = reinterpret_cast<char*>(array) + mItemSize*(j);
} while (j>=0 && (cmp(curr, temp, state) > 0));
+ _do_destroy(next, 1);
_do_copy(next, temp, 1);
}
i++;