I have a simple question hopefully - how does one free memory which was allocated in the try block when the exception occurs? Consider the following code:
try {
Agreed with the answers on RAII and smart pointers.
However, if you insist, you can do this:
try { dangerous operations } catch { cleanup; throw; }