silc_smemdup

SYNOPSIS

    void *silc_smemdup(SilcStack stack, const void *ptr, SilcUInt32 size);

DESCRIPTION

Duplicates the memory area indicated by `ptr' which is the size of `size' bytes. Returns pointer to the duplicated memory area. This NULL terminates the dupped memory area by allocating `size' + 1 bytes, so this function can be used to duplicate strings that does not have NULL termination. This function allocates aligned memory so it can be used to duplicate also structures. Returns NULL on error.

NOTES

Be careful with this function: do not free the returned pointer explicitly and do not save the returned pointer to a permanent location.

If `stack' is NULL this function calls silc_memdup.