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

Commit ecfb0c6f authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "LVM Effects: add malloc checks"

parents 66f0fc01 2a5afed8
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
@@ -728,7 +728,10 @@ int LvmBundle_process(LVM_INT16 *pIn,
                free(pContext->pBundledContext->workBuffer);
            }
            pContext->pBundledContext->workBuffer =
                    (LVM_INT16 *)malloc(frameCount * sizeof(LVM_INT16) * 2);
                    (LVM_INT16 *)calloc(frameCount, sizeof(LVM_INT16) * 2);
            if (pContext->pBundledContext->workBuffer == NULL) {
                return -ENOMEM;
            }
            pContext->pBundledContext->frameCount = frameCount;
        }
        pOutTmp = pContext->pBundledContext->workBuffer;
@@ -2872,7 +2875,7 @@ int Effect_process(effect_handle_t self,
    EffectContext * pContext = (EffectContext *) self;
    LVM_ReturnStatus_en     LvmStatus = LVM_SUCCESS;                /* Function call status */
    int    status = 0;
    int    lvmStatus = 0;
    int    processStatus = 0;
    LVM_INT16   *in  = (LVM_INT16 *)inBuffer->raw;
    LVM_INT16   *out = (LVM_INT16 *)outBuffer->raw;

@@ -2966,13 +2969,16 @@ int Effect_process(effect_handle_t self,
        pContext->pBundledContext->NumberEffectsCalled = 0;
        /* Process all the available frames, block processing is
           handled internalLY by the LVM bundle */
        lvmStatus = android::LvmBundle_process(    (LVM_INT16 *)inBuffer->raw,
        processStatus = android::LvmBundle_process(    (LVM_INT16 *)inBuffer->raw,
                                                (LVM_INT16 *)outBuffer->raw,
                                                outBuffer->frameCount,
                                                pContext);
        if(lvmStatus != LVM_SUCCESS){
            ALOGV("\tLVM_ERROR : LvmBundle_process returned error %d", lvmStatus);
            return lvmStatus;
        if (processStatus != 0){
            ALOGV("\tLVM_ERROR : LvmBundle_process returned error %d", processStatus);
            if (status == 0) {
                status = processStatus;
            }
            return status;
        }
    } else {
        //ALOGV("\tEffect_process Not Calling process with %d effects enabled, %d called: Effect %d",