summaryrefslogtreecommitdiffstats
path: root/media/libmedia/IAudioTrack.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2009-09-09 05:16:08 -0700
committerEric Laurent <elaurent@google.com>2009-09-09 05:16:08 -0700
commit5841db78dff14898538200287d246577b1fc37e2 (patch)
tree3d3cd806d443584a23a4ac3b3731ca3ba761c58e /media/libmedia/IAudioTrack.cpp
parent85fa14d35468acca07ce0085d67b909f673fae07 (diff)
downloadframeworks_av-5841db78dff14898538200287d246577b1fc37e2.zip
frameworks_av-5841db78dff14898538200287d246577b1fc37e2.tar.gz
frameworks_av-5841db78dff14898538200287d246577b1fc37e2.tar.bz2
Fix issue 2107584: media server crash when AudioFlinger fails to allocate memory for track control block.
AudioFlinger: verify that mCblk is not null before using it in Track and RecordTrack contructors. IAudioFlinger: check result of remote transaction before reading IAudioTrack and IAudioRecord. IAudioTrack and IAudioRecord: check result of remote transaction before reading IMemory.
Diffstat (limited to 'media/libmedia/IAudioTrack.cpp')
-rw-r--r--media/libmedia/IAudioTrack.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/media/libmedia/IAudioTrack.cpp b/media/libmedia/IAudioTrack.cpp
index 75b861b..7f43347 100644
--- a/media/libmedia/IAudioTrack.cpp
+++ b/media/libmedia/IAudioTrack.cpp
@@ -81,9 +81,13 @@ public:
virtual sp<IMemory> getCblk() const
{
Parcel data, reply;
+ sp<IMemory> cblk;
data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor());
- remote()->transact(GET_CBLK, data, &reply);
- return interface_cast<IMemory>(reply.readStrongBinder());
+ status_t status = remote()->transact(GET_CBLK, data, &reply);
+ if (status == NO_ERROR) {
+ cblk = interface_cast<IMemory>(reply.readStrongBinder());
+ }
+ return cblk;
}
};