Skip to main content

xmlMallocImpl

Function xmlMallocImpl 

Source
pub unsafe extern "C" fn xmlMallocImpl(size: usize) -> *mut c_void
Expand description

Allocate memory through the exported xmlMalloc variable.

§UPSTREAM-PARITY

void *xmlMalloc(size_t size);

Every internal allocation site calls this indirection, which reads the current exported xmlMalloc variable — exactly how upstream internal code calls xmlMalloc(...) (the variable, globals.c). With no override the variable holds xmlMallocDefault; after xmlMemSetup or a direct xmlMalloc = custom assignment it holds the custom hook, so all internal allocations observe the override (R-000176 fix, single source of truth).

§SAFETY

  • The returned pointer must be freed with xmlFree
  • size may be 0 (returns a valid non-NULL pointer or NULL)