From 5841db78dff14898538200287d246577b1fc37e2 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Wed, 9 Sep 2009 05:16:08 -0700 Subject: 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. --- media/libmedia/IAudioTrack.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'media/libmedia/IAudioTrack.cpp') 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 getCblk() const { Parcel data, reply; + sp cblk; data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); - remote()->transact(GET_CBLK, data, &reply); - return interface_cast(reply.readStrongBinder()); + status_t status = remote()->transact(GET_CBLK, data, &reply); + if (status == NO_ERROR) { + cblk = interface_cast(reply.readStrongBinder()); + } + return cblk; } }; -- cgit v1.1