Variant 1: if (res == 0) { try { FinalRelease(); } catch (...) { delete this; throw; } delete this; } Variant 2: if (res == 0) { std::auto_ptr delete_after_throw = this; FinalRelease(); // may throw, for example ScriptTest/ExecMode }