If you really need try/finally, you should use RAII since this is C++. Please remove the goto usage :) not looking to start a debate here -- we just don't use it.