I know this is pretty common question, but still new for me!
I don\'t understand concept of dangling pointer, was googling around, and writing test methods to find o
A dangling pointer is a (non-NULL) pointer which points to unallocated (already freed) memory area.
The above example should be correct given that the string is not modified through new_foo.