You are hitting undefined behaviour by dereferencing a pointer which is not valid. Anything can happen. And no, the other pointer is not reset to nullptr when the first one is, these are independent variables.