diff options
author | James Dong <jdong@google.com> | 2010-08-11 17:12:39 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-08-11 17:18:30 -0700 |
commit | 25d83125cee222993673d3ba261ae1186bcad8c2 (patch) | |
tree | ff9cb1abe9343695635b261a2c24906baba9794f | |
parent | eaf0e0786c4c21d6c63d8f1f4515cb2a5311493b (diff) | |
download | frameworks_av-25d83125cee222993673d3ba261ae1186bcad8c2.zip frameworks_av-25d83125cee222993673d3ba261ae1186bcad8c2.tar.gz frameworks_av-25d83125cee222993673d3ba261ae1186bcad8c2.tar.bz2 |
Fix all fd leaks in authoring engine
Change-Id: I17798543f9dd41cc8bef6f6086e66932f9f97be8
-rw-r--r-- | media/libmedia/IMediaRecorder.cpp | 2 | ||||
-rw-r--r-- | media/libmediaplayerservice/StagefrightRecorder.cpp | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/media/libmedia/IMediaRecorder.cpp b/media/libmedia/IMediaRecorder.cpp index 4eb63e8..947ff34 100644 --- a/media/libmedia/IMediaRecorder.cpp +++ b/media/libmedia/IMediaRecorder.cpp @@ -23,6 +23,7 @@ #include <camera/ICamera.h> #include <media/IMediaRecorderClient.h> #include <media/IMediaRecorder.h> +#include <unistd.h> namespace android { @@ -373,6 +374,7 @@ status_t BnMediaRecorder::onTransact( int64_t offset = data.readInt64(); int64_t length = data.readInt64(); reply->writeInt32(setOutputFile(fd, offset, length)); + ::close(fd); return NO_ERROR; } break; case SET_VIDEO_SIZE: { diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp index f6f89c7..8481d49 100644 --- a/media/libmediaplayerservice/StagefrightRecorder.cpp +++ b/media/libmediaplayerservice/StagefrightRecorder.cpp @@ -55,11 +55,6 @@ StagefrightRecorder::StagefrightRecorder() StagefrightRecorder::~StagefrightRecorder() { LOGV("Destructor"); stop(); - - if (mOutputFd >= 0) { - ::close(mOutputFd); - mOutputFd = -1; - } } status_t StagefrightRecorder::init() { @@ -1084,6 +1079,11 @@ status_t StagefrightRecorder::stop() { mFlags = 0; } + if (mOutputFd >= 0) { + ::close(mOutputFd); + mOutputFd = -1; + } + return OK; } |