Skip to main content

ddwaf_allocator_free

Function ddwaf_allocator_free 

Source
pub unsafe extern "C" fn ddwaf_allocator_free(
    alloc: ddwaf_allocator,
    p: *mut c_void,
    bytes: usize,
    alignment: usize,
)
Expand description

Releases a block of memory previously obtained via ddwaf_allocator_alloc from the same allocator.

Requirements and safety:

  • p must point to memory returned by ddwaf_allocator_alloc using alloc.
  • bytes and alignment must match the values used for the allocation.
  • After this call, the memory referenced by p must no longer be accessed.
  • Do not mix allocators; freeing with a different allocator is undefined.
  • Thread-safety depends on the allocator type; see the corresponding allocator init function for details.

@param alloc Allocator used for the original allocation. (nonnull) @param p Pointer to the memory to free. (nonnull) @param bytes Size in bytes of the original allocation. @param alignment Alignment in bytes of the original allocation.