Quote Originally Posted by john.c View Post
That's not quite right. Although the pointer lives on main's stack, the memory it points to is on the heap since it is (presumably) dynamically allocated by readline. Note that that memory is freed in main in the loop that pops the stack elements.
Oh yea. So readline is allocating str's eventually in the HEAP - so we have nothing to fear at all when we free the struct.

Thank you!