Beispiel #1
0
// vlddelete - Local helper function that actually frees memory back to VLD's
//   private heap.
//
//  - block (IN): Pointer to a memory block being freed.
//
//  Return Value:
//
//    None.
//
void vlddelete (void *block)
{
    if (block == NULL)
        return;

    BOOL              freed;
    vldblockheader_t *header = VLDBLOCKHEADER((LPVOID)block);

    // Unlink the block from the block list.
    g_vldHeapLock.Enter();
    if (header->prev) {
        header->prev->next = header->next;
    }
    else {
        g_vldBlockList = header->next;
    }

    if (header->next) {
        header->next->prev = header->prev;
    }
    g_vldHeapLock.Leave();

    // Free the block.
    freed = RtlFreeHeap(g_vldHeap, 0x0, header);
    assert(freed != FALSE);
}
Beispiel #2
0
// vlddelete - Local helper function that actually frees memory back to VLD's
//   private heap.
//
//  - block (IN): Pointer to a memory block being freed.
//
//  Return Value:
//
//    None.
//
void vlddelete (void *block)
{
    BOOL              freed;
    vldblockheader_t *header = VLDBLOCKHEADER((LPVOID)block);

    // Unlink the block from the block list.
    EnterCriticalSection(&vldheaplock);
    if (header->prev) {
        header->prev->next = header->next;
    }
    else {
        vldblocklist = header->next;
    }

    if (header->next) {
        header->next->prev = header->prev;
    }
    LeaveCriticalSection(&vldheaplock);

    // Free the block.
    freed = RtlFreeHeap(vldheap, 0x0, header);
    assert(freed != FALSE);
}