summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@android.com>2013-05-30 01:58:45 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-05-30 01:58:45 +0000
commit86b2ecdd311fca2e1e4a3504bf96bb23c5630492 (patch)
tree9604d7fcc2ce7861e7a6d6c0ccc7cfbe6a0c5c98
parent1c45dc66c77f0ddb246a55d780206a183740ff7f (diff)
parent3f727c0ea3ad1de512c935c6e80423f2115b46c0 (diff)
downloadnative-86b2ecdd311fca2e1e4a3504bf96bb23c5630492.tar.gz
Merge "fix mem leak on error handling"
-rw-r--r--libs/binder/Parcel.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 8f7f7e76d5..c7bdcbca4a 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -1472,6 +1472,8 @@ status_t Parcel::continueWrite(size_t desired)
if (objectsSize) {
objects = (size_t*)malloc(objectsSize*sizeof(size_t));
if (!objects) {
+ free(data);
+
mError = NO_MEMORY;
return NO_MEMORY;
}
@@ -1552,7 +1554,7 @@ status_t Parcel::continueWrite(size_t desired)
mError = NO_MEMORY;
return NO_MEMORY;
}
-
+
if(!(mDataCapacity == 0 && mObjects == NULL
&& mObjectsCapacity == 0)) {
ALOGE("continueWrite: %d/%p/%d/%d", mDataCapacity, mObjects, mObjectsCapacity, desired);