summaryrefslogtreecommitdiffstats
path: root/media/mtp/MtpServer.h
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-04-25 13:37:44 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-04-25 13:37:44 -0700
commitc0502468a29aa2f2b3457e0e08c4a5650a70488d (patch)
tree02dab2163433f5aba08381782eb4daa4791a113f /media/mtp/MtpServer.h
parentf87d18a374f0275b1adb89a495931390f7407fd2 (diff)
parentc3f16e5620c090aeb75c0836572a8b913a4ef864 (diff)
downloadframeworks_av-c0502468a29aa2f2b3457e0e08c4a5650a70488d.zip
frameworks_av-c0502468a29aa2f2b3457e0e08c4a5650a70488d.tar.gz
frameworks_av-c0502468a29aa2f2b3457e0e08c4a5650a70488d.tar.bz2
Merge "MTP: Fix file descriptor leak in file editing extensions"
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;