@Pranavpurkar
I am writing in the more simple way
Here let’s say if change $head$ pointer to point to $p$ without deleting the node $a$ and node $b$, so we won’t have any means to access node $a$ and node $b$ so there will be a memory leak but there is no dangling pointer.
If I first delete the node $a$ and $b$ (i.e. I free up the memory) then change the $head$ pointer to $p$ there will be no memory leak neither there will be any dangling pointer.
If I delete the node $a$ and $b$ (i.e. I free up the memory) and do not change $head$ pointer, now I do not have access to the memory location where node $a$ and $b$ was present because I freed the memory then $head$ pointer will be the dangling pointer because it still points to the same memory location which I just freed. So if I try to de-reference the $head$ pointer I will get segmentation fault. So in this case memory leak is not there but dangling pointer is there.
@Nisha Bharti I am using them interchangeably, both means the same that I free that memory location so that it can be used later.