summaryrefslogtreecommitdiffstats
path: root/media/mtp/MtpServer.h
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-04-25 12:56:21 -0700
committerMike Lockwood <lockwood@android.com>2011-05-03 21:03:57 -0400
commitc9ee8c2dd7d0860b41a3312bbf7ff390f5d0cf8e (patch)
treea206ea8f7fc0497e842750d0b497fdf5cccfb651 /media/mtp/MtpServer.h
parent4d9da14065fea7bca759f83c419ce10bd1195e83 (diff)
downloadframeworks_av-c9ee8c2dd7d0860b41a3312bbf7ff390f5d0cf8e.zip
frameworks_av-c9ee8c2dd7d0860b41a3312bbf7ff390f5d0cf8e.tar.gz
frameworks_av-c9ee8c2dd7d0860b41a3312bbf7ff390f5d0cf8e.tar.bz2
DO NOT MERGE MTP: Fix file descriptor leak in file editing extensions
Change-Id: Ie0b979b5cfd9b5f9e9196c5f8c8ecccef6ed84c3 Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'media/mtp/MtpServer.h')
-rw-r--r--media/mtp/MtpServer.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/media/mtp/MtpServer.h b/media/mtp/MtpServer.h
index 35a38e7..b06eb28 100644
--- a/media/mtp/MtpServer.h
+++ b/media/mtp/MtpServer.h
@@ -67,12 +67,22 @@ private:
// represents an MTP object that is being edited using the android extensions
// for direct editing (BeginEditObject, SendPartialObject, TruncateObject and EndEditObject)
- struct ObjectEdit {
- MtpObjectHandle handle;
- MtpString path;
- uint64_t size;
- MtpObjectFormat format;
- int fd;
+ class ObjectEdit {
+ public:
+ MtpObjectHandle mHandle;
+ MtpString mPath;
+ uint64_t mSize;
+ MtpObjectFormat mFormat;
+ int mFD;
+
+ ObjectEdit(MtpObjectHandle handle, const char* path, uint64_t size,
+ MtpObjectFormat format, int fd)
+ : mHandle(handle), mPath(path), mSize(size), mFormat(format), mFD(fd) {
+ }
+
+ virtual ~ObjectEdit() {
+ close(mFD);
+ }
};
Vector<ObjectEdit*> mObjectEditList;