Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e67e893d authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

audiohal: Check the result from IAllocator::allocate

The code wasn't checking the return from IAllocator::allocate
resulting in a crash from HIDL framework when there was an error.

Bug: 34635658
Change-Id: Ia6146ec0be972f261d35852fdc44302b67e44898
Test: Run android.media.cts.AudioTrackTest#testPlayStreamData
parent ceec4a06
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ status_t EffectBufferHalHidl::init() {
                    retval = OK;
                }
            });
    if (retval == OK) {
    if (result.isOk() && retval == OK) {
        mMemory = hardware::mapMemory(mHidlBuffer.data);
        if (mMemory != 0) {
            mMemory->update();
@@ -91,8 +91,10 @@ status_t EffectBufferHalHidl::init() {
            ALOGE("Failed to map allocated ashmem");
            retval = NO_MEMORY;
        }
    } else {
        ALOGE("Failed to allocate %d bytes from ashmem", (int)mBufferSize);
    }
    return retval;
    return result.isOk() ? retval : FAILED_TRANSACTION;
}

audio_buffer_t* EffectBufferHalHidl::audioBuffer() {