I have the following method that I use to replace one node of a binary tree with another:
Code:
int inttree_replace(TreeNode *destination, TreeNode *node)
{
	//Return false if either node is invalid
	if (!inttree_isnode(destination) || !inttree_isnode(node)) return false;
 
	//Copy the entire node as a block of memory into the new position
	node = (TreeNode *) memmove(destination, node, sizeof(TreeNode));
 
	//The destination pointer is no longer valid
	destination = NULL;
 
	//Return true for success
	return true;
}
I'm just not sure if I'm clearing up all the memory allocated earlier. As I understand it, using "memmove" moves a block of memory from A to B, so presumably I don't need to free up the original block of memory at A? I've also avoided using "free(destination)" because, after the "memmove" statement, I'd imagine that it's pointing to the new block of memory - is this right?

Basically, could someone tell me if I'm doing anything wrong by copying memory in this way? Thanks.