diff options
author | Eric Laurent <elaurent@google.com> | 2009-09-09 05:16:08 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2009-09-09 05:16:08 -0700 |
commit | 8a77a995c961c7c9a3888f4212f7be87d08afae1 (patch) | |
tree | 02f32484af3e6cf8e302c67d1518f7feeb54c0be /media/libmedia/IAudioTrack.cpp | |
parent | 0c065d9ef17ad9e045391bab3630a49fb998250c (diff) | |
download | frameworks_base-8a77a995c961c7c9a3888f4212f7be87d08afae1.zip frameworks_base-8a77a995c961c7c9a3888f4212f7be87d08afae1.tar.gz frameworks_base-8a77a995c961c7c9a3888f4212f7be87d08afae1.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.cpp | 8 |
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; } }; |