Duplicates the memory area indicated by `ptr' which is of 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.