summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2016-01-27 08:02:48 -0800
committerSteve Kondik <steve@cyngn.com>2016-07-15 13:04:30 -0700
commite481771aa3de37a8cf01a36c5637f0cc48506205 (patch)
treebdd2a8b97ec2f3872104f8ab3dcde3b712834acc
parent0c5f3af37ab6b38125984405ee022c0b1799e6a9 (diff)
downloadframeworks_native-e481771aa3de37a8cf01a36c5637f0cc48506205.zip
frameworks_native-e481771aa3de37a8cf01a36c5637f0cc48506205.tar.gz
frameworks_native-e481771aa3de37a8cf01a36c5637f0cc48506205.tar.bz2
Parcel: file descriptor leak
Resolve a file descriptor leak when a request for ashmem size adjustment is not filed. Change-Id: I4ebccfd096ec5313725fd99dc3e025f9561d061f
-rw-r--r--libs/binder/Parcel.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index cf22e58..1aaee92 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -173,15 +173,14 @@ static void release_object(const sp<ProcessState>& proc,
return;
}
case BINDER_TYPE_FD: {
- if (outAshmemSize != NULL) {
- if (obj.cookie != 0) {
+ if (obj.cookie != 0) { // owned
+ if (outAshmemSize != NULL) {
int size = ashmem_get_size_region(obj.handle);
if (size > 0) {
*outAshmemSize -= size;
}
-
- close(obj.handle);
}
+ close(obj.handle);
#ifdef DISABLE_ASHMEM_TRACKING
} else if (obj.cookie != 0) {
close(obj.handle);