summaryrefslogtreecommitdiffstats
path: root/include/binder
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-11-04 19:01:44 -0700
committerJeff Brown <jeffbrown@google.com>2011-11-04 19:26:03 -0700
commit93ff1f985e233fe04412a65041e977c9f0c21f5b (patch)
tree2df87eb4ecff390bb6b43c8ff1f018a030844a23 /include/binder
parentedc0bf55363230138c5eac11763055b4d471e850 (diff)
downloadframeworks_native-93ff1f985e233fe04412a65041e977c9f0c21f5b.zip
frameworks_native-93ff1f985e233fe04412a65041e977c9f0c21f5b.tar.gz
frameworks_native-93ff1f985e233fe04412a65041e977c9f0c21f5b.tar.bz2
Fix a leak in Parcel::writeBlob.
Was mistakenly assuming that Parcel::writeFileDescriptor took ownership of the fd that was passed in. It does not! Added some comments and a default parameter to allow the caller to specify whether it wishes the Parcel to take ownership. Bug: 5563374 Change-Id: I5a12f51d582bf246ce90133cce7690bb9bca93f6
Diffstat (limited to 'include/binder')
-rw-r--r--include/binder/Parcel.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h
index 3fa2acb..33b2f00 100644
--- a/include/binder/Parcel.h
+++ b/include/binder/Parcel.h
@@ -110,7 +110,8 @@ public:
// Place a file descriptor into the parcel. The given fd must remain
// valid for the lifetime of the parcel.
- status_t writeFileDescriptor(int fd);
+ // The Parcel does not take ownership of the given fd unless you ask it to.
+ status_t writeFileDescriptor(int fd, bool takeOwnership = false);
// Place a file descriptor into the parcel. A dup of the fd is made, which
// will be closed once the parcel is destroyed.