The parameter block that you wish to free must have been created using slapi_pblock_new(). Use of this function with parameter blocks allocated on the stack, with Slapi_PBlock pb;, or using another memory allocator, is not supported and may lead to memory errors and memory leaks. For example:
Slapi_PBlock *pb = malloc(sizeof(Slapi_PBlock));
After calling this function, you should set the parameter block pointer to NULL to avoid reusing freed memory in your function context, as in the following:
slapi_pblock_destroy(pb); pb = NULL;
If you reuse the pointer in this way, it makes it easier to identify a Segmentation Fault, rather than using some difficult method to detect memory leaks or other abnormal behavior.
It is safe to call this function with a NULL pointer. For example:
Slapi_PBlock *pb = NULL; slapi_pblock_destroy(pb);
This saves the trouble of checking for NULL before calling slapi_pblock_destroy().