You would put the cleanup code in a separate function, and call it.
I don't think there's anything wrong with using goto in such a case, though, if it makes the code more understandable.
I don't think there's anything wrong with using goto in such a case, though, if it makes the code more understandable.
[1] http://eli.thegreenplace.net/2009/04/27/using-goto-for-error...