FreeBSD/sys/contrib/dev/acpica/components/utilities/uttrack.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiUtRemoveAllocation
 *
 * PARAMETERS:  Allocation          - Address of allocated memory
 *              Component           - Component type of caller
 *              Module              - Source file name of caller
 *              Line                - Line number of caller
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Deletes an element from the global allocation tracking list.
 *
 ******************************************************************************/
AcpiUtRemoveAllocation
PARAMETERS:  Allocation          - Address of allocated memory
Component           - Component type of caller
Module              - Source file name of caller
Line                - Line number of caller

Status

Deletes an element from the global allocation tracking list.
AcpiUtRemoveAllocation PARAMETERS : Allocation - Address of allocated memory Component - Component type of caller Module - Source file name of caller Line - Line number of caller Status Deletes an element from the global allocation tracking list .
static ACPI_STATUS
AcpiUtRemoveAllocation (
    ACPI_DEBUG_MEM_BLOCK    *Allocation,
    UINT32                  Component,
    const char              *Module,
    UINT32                  Line)
{
    ACPI_MEMORY_LIST        *MemList;
    ACPI_STATUS             Status;
    ACPI_FUNCTION_NAME (UtRemoveAllocation);
    if (AcpiGbl_DisableMemTracking)
    {
        return (AE_OK);
    }
    MemList = AcpiGbl_GlobalList;
    if (NULL == MemList->ListHead)
    {
        ACPI_ERROR ((Module, Line,
            "Empty allocation list, nothing to free!"));
        return (AE_OK);
    }
    Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
    if (ACPI_FAILURE (Status))
    {
        return (Status);
    }
    if (Allocation->Previous)
    {
        (Allocation->Previous)->Next = Allocation->Next;
    }
    else
    {
        MemList->ListHead = Allocation->Next;
    }
    if (Allocation->Next)
    {
        (Allocation->Next)->Previous = Allocation->Previous;
    }
    ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing %p, size 0%X\n",
        &Allocation->UserSpace, Allocation->Size));
    memset (&Allocation->UserSpace, 0xEA, Allocation->Size);
    Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
    return (Status);
}
static ACPI_STATUS AcpiUtRemoveAllocation ( ACPI_DEBUG_MEM_BLOCK * Allocation , UINT32 Component , const char * Module , UINT32 Line ) { ACPI_MEMORY_LIST * MemList ; ACPI_STATUS Status ; ACPI_FUNCTION_NAME ( UtRemoveAllocation ) ; if ( AcpiGbl_DisableMemTracking ) { return ( AE_OK ) ; } MemList = AcpiGbl_GlobalList ; if ( NULL == MemList -> ListHead ) { ACPI_ERROR ( ( Module , Line , " " ) ) ; return ( AE_OK ) ; } Status = AcpiUtAcquireMutex ( ACPI_MTX_MEMORY ) ; if ( ACPI_FAILURE ( Status ) ) { return ( Status ) ; } if ( Allocation -> Previous ) { ( Allocation -> Previous ) -> Next = Allocation -> Next ; } else { MemList -> ListHead = Allocation -> Next ; } if ( Allocation -> Next ) { ( Allocation -> Next ) -> Previous = Allocation -> Previous ; } ACPI_DEBUG_PRINT ( ( ACPI_DB_ALLOCATIONS , " \n " , & Allocation -> UserSpace , Allocation -> Size ) ) ; memset ( & Allocation -> UserSpace , 0xEA , Allocation -> Size ) ; Status = AcpiUtReleaseMutex ( ACPI_MTX_MEMORY ) ; return ( Status ) ; }
FUNCTION:    AcpiUtRemoveAllocation
 PARAMETERS:  Allocation          - Address of allocated memory
              Component           - Component type of caller
              Module              - Source file name of caller
              Line                - Line number of caller
FUNCTION : AcpiUtRemoveAllocation PARAMETERS : Allocation - Address of allocated memory Component - Component type of caller Module - Source file name of caller Line - Line number of caller
/* No allocations! */ /* Unlink */ /* Mark the segment as deleted */