Sun Java System Directory Server Enterprise Edition 6.0 Developer's Guide


Frees the specified parameter block from memory.


#include "slapi-plugin.h"
void slapi_pblock_destroy( Slapi_PBlock *pb );


This function takes the following parameters:


Parameter block that you wish to free.

Memory Concerns

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:

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;

This saves the trouble of checking for NULL before calling slapi_pblock_destroy().

See Also