Parcel: file descriptor leak

Resolve a file descriptor leak when a request for
ashmem size adjustment is not filed.

Change-Id: I4ebccfd096ec5313725fd99dc3e025f9561d061f
This commit is contained in:
Mark Salyzyn 2016-01-27 08:02:48 -08:00 committed by Steve Kondik
parent 0c5f3af37a
commit e481771aa3

View File

@ -173,15 +173,14 @@ static void release_object(const sp<ProcessState>& proc,
return; return;
} }
case BINDER_TYPE_FD: { case BINDER_TYPE_FD: {
if (outAshmemSize != NULL) { if (obj.cookie != 0) { // owned
if (obj.cookie != 0) { if (outAshmemSize != NULL) {
int size = ashmem_get_size_region(obj.handle); int size = ashmem_get_size_region(obj.handle);
if (size > 0) { if (size > 0) {
*outAshmemSize -= size; *outAshmemSize -= size;
} }
close(obj.handle);
} }
close(obj.handle);
#ifdef DISABLE_ASHMEM_TRACKING #ifdef DISABLE_ASHMEM_TRACKING
} else if (obj.cookie != 0) { } else if (obj.cookie != 0) {
close(obj.handle); close(obj.handle);