diff options
author | Amith Yamasani <yamasani@google.com> | 2016-06-13 18:37:40 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-06-13 18:37:40 +0000 |
commit | a13a22649b27199a3a368da3f5f3c99c6af4c398 (patch) | |
tree | 3efdf228619f8063c7d580c9766b5e3550c0318b | |
parent | 324b700b4b0669683efff3d696324dc0d4e24ec5 (diff) | |
parent | 6b0b06348d4cc8eb0087d95826dbeba9a72565d8 (diff) | |
download | native-a13a22649b27199a3a368da3f5f3c99c6af4c398.tar.gz |
Merge "Fixed file descriptor leak in IMemory" into nyc-dev
-rw-r--r-- | libs/binder/IMemory.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libs/binder/IMemory.cpp b/libs/binder/IMemory.cpp index fb8d620b4c..5f345cf7b7 100644 --- a/libs/binder/IMemory.cpp +++ b/libs/binder/IMemory.cpp @@ -312,17 +312,17 @@ void BpMemoryHeap::assertReallyMapped() const IInterface::asBinder(this).get(), parcel_fd, size, err, strerror(-err)); - int fd = dup( parcel_fd ); - ALOGE_IF(fd==-1, "cannot dup fd=%d, size=%zd, err=%d (%s)", - parcel_fd, size, err, strerror(errno)); - - int access = PROT_READ; - if (!(flags & READ_ONLY)) { - access |= PROT_WRITE; - } - Mutex::Autolock _l(mLock); if (mHeapId == -1) { + int fd = dup( parcel_fd ); + ALOGE_IF(fd==-1, "cannot dup fd=%d, size=%zd, err=%d (%s)", + parcel_fd, size, err, strerror(errno)); + + int access = PROT_READ; + if (!(flags & READ_ONLY)) { + access |= PROT_WRITE; + } + mRealHeap = true; mBase = mmap(0, size, access, MAP_SHARED, fd, offset); if (mBase == MAP_FAILED) { |