Goto is often the cleanest way to jump to error handling at the end of a function. I always smile at contorted efforts to avoid goto at any cost. Recently I saw something like this:
do {
/* deeply nested code */
if (error) {
break;
}
} while (0);
/* error handling */
And no, it was not the do/while macro trick. It was advertised as structured programming.