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

Commit c673de80 authored by Wei Jia's avatar Wei Jia
Browse files

ACodec: free buffers when allocateBuffers failed.

This fixes ashmem leakage.

Bug: 26797136
Change-Id: I17d61d50e67501ece6a3547eeb33d53279162e71
parent 987f9532
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -5906,6 +5906,15 @@ void ACodec::LoadedToIdleState::stateEntered() {

        mCodec->signalError(OMX_ErrorUndefined, makeNoSideEffectStatus(err));

        mCodec->mOMX->sendCommand(
                mCodec->mNode, OMX_CommandStateSet, OMX_StateLoaded);
        if (mCodec->allYourBuffersAreBelongToUs(kPortIndexInput)) {
            mCodec->freeBuffersOnPort(kPortIndexInput);
        }
        if (mCodec->allYourBuffersAreBelongToUs(kPortIndexOutput)) {
            mCodec->freeBuffersOnPort(kPortIndexOutput);
        }

        mCodec->changeState(mCodec->mLoadedState);
    }
}