summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHyejin Kim <hyejin.kim@lge.com>2013-03-09 11:28:54 +0900
committerSteve Kondik <shade@chemlab.org>2013-05-31 22:15:02 -0700
commitba27ea466575c61c42a435958695a15e69c308e5 (patch)
tree94b37d73db1915cd17b66127f4f970262c4c0653
parent36a29a6147b57b899279c14c1dcf8979fd2c0366 (diff)
downloadframeworks_native-ba27ea466575c61c42a435958695a15e69c308e5.zip
frameworks_native-ba27ea466575c61c42a435958695a15e69c308e5.tar.gz
frameworks_native-ba27ea466575c61c42a435958695a15e69c308e5.tar.bz2
fix mem leak on error handling
Change-Id: I40d8e371c46184aa701fa676246201a9d8f6e27d
-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 4c15913..6a2ef00 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -1429,6 +1429,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;
}
@@ -1509,7 +1511,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);