Frees space allocated by the slapi_ch_malloc(),slapi_ch_realloc(), and slapi_ch_calloc() functions and sets the pointer to NULL. Call this function instead of the standard free() C function.
#include "slapi-plugin.h" void slapi_ch_free( void **ptr );
This function takes the following parameter:
Address of the pointer to the block of memory that you wish to free. If NULL, no action occurs.
The ptr passed to slapi_ch_free() should be the address of a pointer to memory allocated using a call to slapi_ch_malloc(),slapi_ch_realloc(),slapi_ch_calloc(), or slapi_ch_strdup() .