If you are transferring ownership, you would do
p2 = p1; p1 = NULL;
However if you are intentionally doing multiple ownership, then yes you can still have problems.