If the compiler in question does tail call optimization (or even if not), maybe one could write a cleanup function that takes the place of the <i>goto</i> block, but this looks pretty ugly with all the parameters:<p><pre><code>    int cleanup(void *ptr1, char *ptr2, struct foo *ptr3, int *ptr4, union xyz *ptr5, int ret)
    {
      free(ptr1);
      &#x2F;&#x2F; etc.
      return ret;
    }

    &#x2F;&#x2F; later...
      if(fail1) {
        return cleanup(a, b, c, d, e, -1);
      }</code></pre>