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

Commit ef11a2fe authored by Andy Hung's avatar Andy Hung Committed by Gerrit Code Review
Browse files

Merge "libeffects: Fix memory leaks"

parents e5c23c69 77b1437b
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -57,10 +57,7 @@ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t* phInstance, LVDBE_Capabilities_
     * Create the instance handle if not already initialised
     */
    if (*phInstance == LVM_NULL) {
        *phInstance = calloc(1, sizeof(*pInstance));
    }
    if (*phInstance == LVM_NULL) {
        return LVDBE_NULLADDRESS;
        *phInstance = new LVDBE_Instance_t;
    }
    pInstance = (LVDBE_Instance_t*)*phInstance;

@@ -185,6 +182,6 @@ void LVDBE_DeInit(LVDBE_Handle_t* phInstance) {
        free(pInstance->pData);
        pInstance->pData = LVM_NULL;
    }
    free(pInstance);
    delete pInstance;
    *phInstance = LVM_NULL;
}
+2 −5
Original line number Diff line number Diff line
@@ -93,10 +93,7 @@ LVM_ReturnStatus_en LVM_GetInstanceHandle(LVM_Handle_t* phInstance, LVM_InstPara
    /*
     * Create the instance handle
     */
    *phInstance = (LVM_Handle_t)calloc(1, sizeof(*pInstance));
    if (*phInstance == LVM_NULL) {
        return LVM_NULLADDRESS;
    }
    *phInstance = new LVM_Instance_t;
    pInstance = (LVM_Instance_t*)*phInstance;

    pInstance->InstParams = *pInstParams;
@@ -543,7 +540,7 @@ void LVM_DelInstanceHandle(LVM_Handle_t* phInstance) {
        pInstance->pPSAInput = LVM_NULL;
    }

    free(*phInstance);
    delete pInstance;
    return;
}

+2 −5
Original line number Diff line number Diff line
@@ -52,10 +52,7 @@ LVEQNB_ReturnStatus_en LVEQNB_Init(LVEQNB_Handle_t* phInstance,
                                   LVEQNB_Capabilities_t* pCapabilities, void* pScratch) {
    LVEQNB_Instance_t* pInstance;

    *phInstance = calloc(1, sizeof(*pInstance));
    if (phInstance == LVM_NULL) {
        return LVEQNB_NULLADDRESS;
    }
    *phInstance = new LVEQNB_Instance_t;
    pInstance = (LVEQNB_Instance_t*)*phInstance;

    pInstance->Capabilities = *pCapabilities;
@@ -146,6 +143,6 @@ void LVEQNB_DeInit(LVEQNB_Handle_t* phInstance) {
        free(pInstance->pBiquadType);
        pInstance->pBiquadType = LVM_NULL;
    }
    free(pInstance);
    delete pInstance;
    *phInstance = LVM_NULL;
}
+17 −0
Original line number Diff line number Diff line
@@ -189,6 +189,23 @@ LVREV_ReturnStatus_en LVREV_GetInstanceHandle(LVREV_Handle_t* phInstance,
                                              LVREV_MemoryTable_st* pMemoryTable,
                                              LVREV_InstanceParams_st* pInstanceParams);

/****************************************************************************************/
/*                                                                                      */
/* FUNCTION:                LVREV_FreeInstance                                          */
/*                                                                                      */
/* DESCRIPTION:                                                                         */
/*  This function is used to free the internal allocations of the module.               */
/*                                                                                      */
/* PARAMETERS:                                                                          */
/*  hInstance               Instance handle                                             */
/*                                                                                      */
/* RETURNS:                                                                             */
/*  LVREV_SUCCESS          free instance succeeded                                      */
/*  LVREV_NULLADDRESS      Instance is NULL                                             */
/*                                                                                      */
/****************************************************************************************/
LVREV_ReturnStatus_en LVREV_FreeInstance(LVREV_Handle_t hInstance);

/****************************************************************************************/
/*                                                                                      */
/* FUNCTION:                LVXX_GetControlParameters                                   */
+24 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ LVREV_ReturnStatus_en LVREV_GetInstanceHandle(LVREV_Handle_t* phInstance,
     * Set the instance handle if not already initialised
     */
    if (*phInstance == LVM_NULL) {
        *phInstance = InstAlloc_AddMember(&SlowData, sizeof(LVREV_Instance_st));
        *phInstance = new LVREV_Instance_st;
    }
    pLVREV_Private = (LVREV_Instance_st*)*phInstance;
    pLVREV_Private->MemoryTable = *pMemoryTable;
@@ -269,4 +269,27 @@ LVREV_ReturnStatus_en LVREV_GetInstanceHandle(LVREV_Handle_t* phInstance,
    return LVREV_SUCCESS;
}

/****************************************************************************************/
/*                                                                                      */
/* FUNCTION:                LVREV_FreeInstance                                          */
/*                                                                                      */
/* DESCRIPTION:                                                                         */
/*  This function is used to free the internal allocations of the module.               */
/*                                                                                      */
/* PARAMETERS:                                                                          */
/*  hInstance               Instance handle                                             */
/*                                                                                      */
/* RETURNS:                                                                             */
/*  LVREV_SUCCESS          free instance succeeded                                      */
/*  LVREV_NULLADDRESS      Instance is NULL                                             */
/*                                                                                      */
/****************************************************************************************/
LVREV_ReturnStatus_en LVREV_FreeInstance(LVREV_Handle_t hInstance) {
    if (hInstance == LVM_NULL) {
        return LVREV_NULLADDRESS;
    }

    delete (LVREV_Instance_st*)hInstance;
    return LVREV_SUCCESS;
}
/* End of file */
Loading