No no, I think you misunderstood my critic. Defer working on block-scope is fine; however, if I exit the block through a return (or break), the deferred function is not called.
To my knowledge, you need a compiler extension to implement this in C (or use a C++ destructor).