summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2016-02-18 08:25:47 -0800
committerThe Android Automerger <android-build@google.com>2016-02-26 16:56:01 -0800
commitde2430fd7855b7941250e1c3744756ec9e699bd1 (patch)
treef038d5b0569fb5a3203796fbf234f91b67539621
parent582c02ea5c9c8db5f993d784a0a85b275b2e59fd (diff)
downloadframeworks_av-de2430fd7855b7941250e1c3744756ec9e699bd1.zip
frameworks_av-de2430fd7855b7941250e1c3744756ec9e699bd1.tar.gz
frameworks_av-de2430fd7855b7941250e1c3744756ec9e699bd1.tar.bz2
Get service by value instead of reference
to prevent a cleared service binder from being used. Bug: 26040840 Change-Id: Ifb5483c55b172d3553deb80dbe27f2204b86ecdb
-rw-r--r--include/media/mediametadataretriever.h2
-rw-r--r--media/libmedia/mediametadataretriever.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/include/media/mediametadataretriever.h b/include/media/mediametadataretriever.h
index f655f35..8ed07ee 100644
--- a/include/media/mediametadataretriever.h
+++ b/include/media/mediametadataretriever.h
@@ -82,7 +82,7 @@ public:
const char* extractMetadata(int keyCode);
private:
- static const sp<IMediaPlayerService>& getService();
+ static const sp<IMediaPlayerService> getService();
class DeathNotifier: public IBinder::DeathRecipient
{
diff --git a/media/libmedia/mediametadataretriever.cpp b/media/libmedia/mediametadataretriever.cpp
index 9a76f58..08a9e6a 100644
--- a/media/libmedia/mediametadataretriever.cpp
+++ b/media/libmedia/mediametadataretriever.cpp
@@ -35,7 +35,7 @@ Mutex MediaMetadataRetriever::sServiceLock;
sp<IMediaPlayerService> MediaMetadataRetriever::sService;
sp<MediaMetadataRetriever::DeathNotifier> MediaMetadataRetriever::sDeathNotifier;
-const sp<IMediaPlayerService>& MediaMetadataRetriever::getService()
+const sp<IMediaPlayerService> MediaMetadataRetriever::getService()
{
Mutex::Autolock lock(sServiceLock);
if (sService == 0) {
@@ -62,7 +62,7 @@ const sp<IMediaPlayerService>& MediaMetadataRetriever::getService()
MediaMetadataRetriever::MediaMetadataRetriever()
{
ALOGV("constructor");
- const sp<IMediaPlayerService>& service(getService());
+ const sp<IMediaPlayerService> service(getService());
if (service == 0) {
ALOGE("failed to obtain MediaMetadataRetrieverService");
return;