summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/AwesomePlayer.cpp
diff options
context:
space:
mode:
authorTaiju Tsuiki <tzik@google.com>2015-04-21 17:36:22 +0900
committerSteve Kondik <steve@cyngn.com>2015-12-18 17:30:09 -0500
commitf36321997a15edce6ac88414c22efd07da9eb8dc (patch)
treec9a1fd89c4926aa4b1bfadf399418307a280c9dd /media/libstagefright/AwesomePlayer.cpp
parentab9b1e936c2da51d138b3989e90c774ef9bdef7f (diff)
downloadframeworks_av-f36321997a15edce6ac88414c22efd07da9eb8dc.zip
frameworks_av-f36321997a15edce6ac88414c22efd07da9eb8dc.tar.gz
frameworks_av-f36321997a15edce6ac88414c22efd07da9eb8dc.tar.bz2
Fix potential double close in IMediaMetadataRetriever::setDataSource
IMediaMetadataRetriever::setDataSource(fd, offset, length) takes the ownership of |fd| on the direct invocation, and doesn't take the ownership on invocation from Binder. This is inconsintent to other similar methods like IMediaPlayer::setDataSource, and causes potential double close of |fd|. This CL changes the caller and implementations to leave the ownership to make them consistent. Also, fixes a double close in IMediaPlayerService::setDataSource in an error case. Change-Id: Id551a1e725c4392b0fe6b7293871212eb101c0a5
Diffstat (limited to 'media/libstagefright/AwesomePlayer.cpp')
-rw-r--r--media/libstagefright/AwesomePlayer.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 5a43caf..933f241 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -344,6 +344,7 @@ status_t AwesomePlayer::setDataSource(
reset_l();
+ fd = dup(fd);
sp<DataSource> dataSource = new FileSource(fd, offset, length);
status_t err = dataSource->initCheck();