Memory management fixed.

You might (or might not be aware) that the return message calls the destructor for all objects which are created till that scope.
This makes it easy to release memory from complex structures as todo_t easily.

Exit does no effort to destroy any objects. also, it requires extra libraries. Better use return.

On C++ ideology, C++ will make a copy which is appended inside todo. and this is on stack. Be thankful that todo did not receive stack overflow yet.

C++ makes deep copy on all structures as parameters, unless given reference, which means that a pointer to the memory was not passed.... the entire todo was copied onto stack, which was appended in todo->m_list.
 
No memory leaks possible anymore now. :grin: 
why did you remove this?