dangling pointer
A pointer that still holds the address of something that has already been freed or has gone out of scope.
A dangling pointer refers to storage whose lifetime has ended (a freed heap block, a returned function's stack slot); dereferencing it is undefined behaviour and may read stale data, data of a newer object at the same address, or fault.
Examples
Returning the address of a local variable gives the caller a dangling pointer.
See also