Memory management continues to be a trying problem in C++. We must be careful when using legacy C code especially in cases where memory management is required. This is particularly the case when using library code where memory allocation occurs inside the library code. In suce cases, it's crucial to know whose responsibility it is to handle memory deallocation.
In the general case, there are several techniques for memory management, e.g., maintaining state in pointer variables before and after deallocation.
However, it's not all doom and gloom! C++ 11 does add some powerful new features to the language - one if which is the unique_ptr. One of the many merits of the unique_ptr is the way it automatically handles deallocation. It also is resilient in the face of exceptions.
I recommend a close study of this feature of C++ 11.
Check out Stephen Morris' Digital Short Cut "Moving Your Career Up the Value Chain: Building Specialized Development Skills in a Global Economy."